summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/read_concern_helper.js
blob: b83b48bdf34c93032d8b2e3afa3e2761c0f433cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// This tests readConcern handling for the find/findOne shell helpers.
// @tags: [requires_majority_read_concern]
(function() {
    "use strict";
    var testServer = MongoRunner.runMongod();
    if (!testServer.getDB('admin').serverStatus().storageEngine.supportsCommittedReads) {
        jsTest.log("skipping test since storage engine doesn't support committed reads");
        MongoRunner.stopMongod(testServer);
        return;
    }
    var coll = testServer.getDB("test").readMajority;

    assert.doesNotThrow(function() {
        coll.find({_id: "foo"}).readConcern("majority").itcount();
    });
    assert.doesNotThrow(function() {
        coll.findOne({_id: "foo"}, {}, {}, "majority");
    });
    assert.doesNotThrow(function() {
        coll.count({_id: "foo"}, {readConcern: "majority"});
    });
    assert.doesNotThrow(function() {
        coll.find({_id: "foo"}).readConcern("majority").count();
    });

    MongoRunner.stopMongod(testServer);
}());