summaryrefslogtreecommitdiff
path: root/jstests/aggregation/bugs/server7768.js
blob: a6c96d8f912cea889f92a4f1662140382f6f088b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// SEVER-7768 aggregate cmd shouldn't fail when $readPreference is specified
collection = 'server7768';
db[collection].drop();
db[collection].insert({foo:1});
// Can't use aggregate helper here because we need to add $readPreference flag
res = db.runCommand({ 'aggregate': collection
                    , 'pipeline': [{'$project': {'_id': false, 'foo': true}}]
                    , $readPreference: {'mode': 'primary'}
                    });

assert.commandWorked(res);
assert.eq(res.result, [{foo:1}]);