Files
mongo/jstests/aggregation/testSlave.js
Max Hirschhorn 9ad8d6335f SERVER-40076 Tag JS tests with reason they're unable to run in Atlas.
There are likely more JavaScript tests which have been added since
r3.6.9 that still need to be tagged.

(cherry picked from commit 05ec08fa62)
2019-03-11 18:17:29 -04:00

23 lines
703 B
JavaScript

// This test just make sure that aggregation is possible on a secondary node.
// @tags: [
// requires_replication,
// requires_spawning_own_processes,
// ]
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();