lib/mongo/collection/view/map_reduce.rb in mongo-2.16.4 vs lib/mongo/collection/view/map_reduce.rb in mongo-2.17.0

- old
+ new

@@ -113,10 +113,12 @@ def initialize(view, map, reduce, options = {}) @view = view @map_function = map.dup.freeze @reduce_function = reduce.dup.freeze @options = BSON::Document.new(options).freeze + + client.log_warn('The map_reduce operation is deprecated, please use the aggregation pipeline instead') end # Set or get the jsMode flag for the operation. # # @example Set js mode for the operation. @@ -246,23 +248,10 @@ def new(options) MapReduce.new(view, map_function, reduce_function, options) end def initial_query_op(session) - spec = map_reduce_spec(session) - # Read preference isn't simply passed in the command payload - # (it may need to be converted to wire protocol flags). - # Passing it in command payload produces errors on at least - # 5.0 mongoses. - # In the future map_reduce_command should remove :read - # from its return value, however we cannot do this right now - # due to Mongoid 7 relying on :read being returned as part of - # the command - see RUBY-2932. - # Delete :read here for now because it cannot be sent to mongos this way. - spec = spec.dup - spec[:selector] = spec[:selector].dup - spec[:selector].delete(:read) - Operation::MapReduce.new(spec) + Operation::MapReduce.new(map_reduce_spec(session)) end def valid_server?(server) if secondary_ok? true