In 2d9f0217ec904a1952a1ada2136502eefbca562e (RUBY-2220) the MapReduce builder was changed to specify read preference externally to the command payload itself, so that it could be correctly passed to pre-3.6 servers. Unfortunately this fix broke read preference passing from Mongoid which relied on the MR builder in driver including read preference in the command payload. This affects Mongoid 7.4-stable going back to at least 7.2.0.
On Mongoid master this was fixed with the following change:
index afe68fc7a..964537005 100644 --- a/lib/mongoid/contextual/map_reduce.rb +++ b/lib/mongoid/contextual/map_reduce.rb @@ -147,7 +147,7 @@ module Mongoid def raw validate_out! cmd = command - opts = { read: cmd.delete(:read) } if cmd[:read] + opts = { read: criteria.options.fetch(:read) } if criteria.options[:read] @map_reduce.database.command(cmd, (opts || {}).merge(session: _session)).first end alias :results :raw
... in e2c854a9a90f9f19ef6077b4b185aeb319e4b9d7.
- is caused by
-
RUBY-2220 Move find command construction code into operations layer
- Closed
- links to