Method: Mongo::Collection::View::Readable#map_reduce

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

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

Execute a map/reduce operation on the collection view.

Examples:

Execute a map/reduce.

view.map_reduce(map, reduce)

Parameters:

  • The map js function.

  • The reduce js function.

  • (defaults to: {})

    The map/reduce options.

Returns:

  • The map reduce wrapper.

Since:

  • 2.0.0

API:

  • semipublic



391
392
393
# File 'lib/mongo/collection/view/readable.rb', line 391

def map_reduce(map, reduce, options = {})
  MapReduce.new(self, map, reduce, @options.merge(options))
end