summaryrefslogtreecommitdiff
path: root/jstests/core/mr_single_reduce.js
blob: 28e66c71c723725bf1a7d91514369e7eb15caa15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(function() {
"use strict";
const coll = db.bar;

assert.commandWorked(coll.insert({x: 1}));

const map = function() {
    emit(0, "mapped value");
};

const reduce = function(key, values) {
    return "reduced value";
};

const res = assert.commandWorked(
    db.runCommand({mapReduce: 'bar', map: map, reduce: reduce, out: {inline: 1}}));
assert.eq(res.results[0], {_id: 0, value: "reduced value"});
}());