Skip to content

Commit 4960f2f

Browse files
p-mongop
andauthored
MONGOID-5395 Call aggregate directly on collection instead of on find view (#5343)
Co-authored-by: Oleg Pudeyev <[email protected]>
1 parent ccf777b commit 4960f2f

File tree

1 file changed

+1
-1
lines changed
  • lib/mongoid/contextual/aggregable

1 file changed

+1
-1
lines changed

lib/mongoid/contextual/aggregable/mongo.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module Mongo
2626
# If no documents are found, then returned Hash will have
2727
# count, sum of 0 and max, min, avg of nil.
2828
def aggregates(field)
29-
result = collection.find.aggregate(pipeline(field), session: _session).to_a
29+
result = collection.aggregate(pipeline(field), session: _session).to_a
3030
if result.empty?
3131
if Mongoid.broken_aggregables
3232
{ "count" => 0, "sum" => nil, "avg" => nil, "min" => nil, "max" => nil }

0 commit comments

Comments
 (0)