Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.
-
map
(function | string) - The mapping function. -
reduce
(function | string) - The reduce function. -
options
(Object) - Need to specify at least theout
option. -
[
callback
] (function)
A promise.
// Map function
var map = function () { emit(this.user_id, 1) }
// Reduce function
var reduce = function (k, vals) { return 1 }
users.mapReduce(map, reduce, {out: {replace: 'tempCollection'}}).then((collection) => {})