Method: Mongoid::Collection#map_reduce

Defined in:
lib/mongoid/collection.rb

#map_reduce(map, reduce, options = {}) ⇒ Cursor Also known as: mapreduce

Perform a map/reduce on the documents.

Examples:

Perform the map/reduce.

collection.map_reduce(map, reduce)

Parameters:

  • map (String)

    The map javascript function.

  • reduce (String)

    The reduce javascript function.

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

    The options to pass to the db.

Returns:



112
113
114
# File 'lib/mongoid/collection.rb', line 112

def map_reduce(map, reduce, options = {})
  master(options).map_reduce(map, reduce, options)
end