Skip to content

Commit ec97cd6

Browse files
committed
RUBY-331 fix sort on Collection#map_reduce
1 parent e613880 commit ec97cd6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/mongo/collection.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,9 @@ def map_reduce(map, reduce, opts={})
611611
hash['map'] = map
612612
hash['reduce'] = reduce
613613
hash.merge! opts
614+
if hash[:sort]
615+
hash[:sort] = Mongo::Support.format_order_clause(hash[:sort])
616+
end
614617

615618
result = @db.command(hash)
616619
unless Mongo::Support.ok?(result)

0 commit comments

Comments
 (0)