Skip to content

Commit 6d2814d

Browse files
authored
Update mongo.rb to add hint in the aggregates
1 parent f16b297 commit 6d2814d

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

lib/mongoid/contextual/aggregable/mongo.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ module Mongo
2727
# If no documents are found, then returned Hash will have
2828
# count, sum of 0 and max, min, avg of nil.
2929
def aggregates(field)
30-
result = collection.aggregate(pipeline(field), session: _session).to_a
30+
hint = options[:hint]
31+
result = collection.aggregate(pipeline(field), session: _session, hint: hint).to_a
3132
if result.empty?
3233
Aggregable::EMPTY_RESULT.dup
3334
else

0 commit comments

Comments
 (0)