blob: ce6ee597218da4b3763de82eb9b0734a8b28ef89 (
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.
// @tags: [requires_replication]
var replTest = new ReplSetTest({name: 'aggTestSlave', nodes: 2});
var nodes = replTest.startSet();
replTest.initiate();
replTest.awaitReplication();
var primary = replTest.getPrimary().getDB('test');
var secondary = replTest.getSecondary().getDB('test');
var options = {writeConcern: {w: 2}};
primary.agg.insert({}, options);
primary.agg.insert({}, options);
primary.agg.insert({}, options);
var res = secondary.agg.aggregate({$group: {_id: null, count: {$sum: 1}}});
assert.eq(res.toArray(), [{_id: null, count: 3}]);
replTest.stopSet();
|