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

- 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), session: _session).to_a if result.empty? { "count" => 0, "sum" => nil, "avg" => nil, "min" => nil, "max" => nil } else result.first end