-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
MongoDB and Mongoid allows settings the output of a MR operation, including the database that the MR operation should write to.
Mongoid subsequently queries the database of the collection that the MR operation was performed on and not the database where the results were written.
# will always return 0 and not query other.bar Foo.map_reduce(map, reduce).out({ replace: 'bar', db: 'other' }).count
The session used to query the results should take the out argument into consideration along the lines of session.with(database: out[:db]) instead of just using the session object that comes with Mongoid::Command.