blob: 421948624c508535e5bf727fdd0026d22110f9f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// This test just make sure that aggregation is possible on a secondary node.
var replTest = new ReplSetTest( {name: 'aggTestSlave', nodes: 2} );
var nodes = replTest.startSet();
replTest.initiate();
replTest.awaitReplication();
var mast = nodes[0].getDB('test');
var slav = nodes[1].getDB('test');
mast.agg.insert({});
mast.agg.insert({});
mast.agg.insert({});
mast.getLastError(2);
var res = slav.agg.aggregate({$group: {_id: null, count: {$sum: 1}}});
assert.commandWorked(res);
assert.eq(res.result, [{_id:null, count: 3}]);
replTest.stopSet();
|