diff --git a/lib/qme/map/map_reduce_executor.rb b/lib/qme/map/map_reduce_executor.rb index 68fb867..824a377 100644 --- a/lib/qme/map/map_reduce_executor.rb +++ b/lib/qme/map/map_reduce_executor.rb @@ -103,7 +103,7 @@ def calculate_supplemental_data_elements pipeline << group1 pipeline << group2 - aggregate = get_db.command(:aggregate => 'patient_cache', :pipeline => pipeline) + aggregate = get_db.command(:aggregate => 'patient_cache', :pipeline => pipeline, allowDiskUse:true) aggregate_document = aggregate.documents[0] v = {} (aggregate_document["result"] || []).each do |entry| @@ -138,7 +138,7 @@ def count_records_in_measure_groups QME::QualityReport::CONSIDERED => {"$sum" => 1} }} - aggregate = get_db.command(:aggregate => 'patient_cache', :pipeline => pipeline) + aggregate = get_db.command(:aggregate => 'patient_cache', :pipeline => pipeline, allowDiskUse:true) aggregate_document = aggregate.documents[0] if !aggregate.successful? raise RuntimeError, "Aggregation Failed" @@ -188,7 +188,7 @@ def calculate_cv_aggregation cv_pipeline << {'$unwind' => '$value.values'} cv_pipeline << {'$group' => {'_id' => '$value.values', 'count' => {'$sum' => 1}}} - aggregate = get_db.command(:aggregate => 'patient_cache', :pipeline => cv_pipeline) + aggregate = get_db.command(:aggregate => 'patient_cache', :pipeline => cv_pipeline, allowDiskUse:true) aggregate_document = aggregate.documents[0] raise RuntimeError, "Aggregation Failed" if aggregate_document['ok'] != 1