lib/mongoid/contextual/aggregable/mongo.rb in mongoid-6.4.8 vs lib/mongoid/contextual/aggregable/mongo.rb in mongoid-7.0.0.beta

- old
+ new

@@ -21,10 +21,10 @@ # "avg" => 750.0 # } # # @since 3.0.0 def aggregates(field) - result = collection.find.aggregate(pipeline(field), session: _session).to_a + result = collection.find.aggregate(pipeline(field)).to_a if result.empty? { "count" => 0, "sum" => nil, "avg" => nil, "min" => nil, "max" => nil } else result.first end