Method: Mongo::Collection::View::MapReduce#initialize

Defined in:
lib/mongo/collection/view/map_reduce.rb

#initialize(view, map, reduce, options = {}) ⇒ MapReduce

Initialize the map/reduce for the provided collection view, functions and options.

Examples:

Create the new map/reduce view.


Parameters:

  • view (Collection::View)

    The collection view.

  • map (String)

    The map function.

  • reduce (String)

    The reduce function.

  • options (Hash) (defaults to: {})

    The map/reduce options.

Since:

  • 2.0.0



121
122
123
124
125
126
127
128
# File 'lib/mongo/collection/view/map_reduce.rb', line 121

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