summaryrefslogtreecommitdiff
path: root/jstests/readonly/write_ops.js
blob: bde5d231ca6eb5459649dd2af20033738eb38244 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
load("jstests/readonly/lib/read_only_test.js");

runReadOnlyTest(function() {
    'use strict';
    return {
        name: 'write_ops',
        load: function(writableCollection) {
            assert.writeOK(writableCollection.insert({x: 1}));
        },
        exec: function(readableCollection) {
            // Test that insert fails.
            assert.writeError(readableCollection.insert({x: 2}));

            // Test that delete fails.
            assert.writeError(readableCollection.remove({x: 1}));

            // Test that update fails.
            assert.writeError(readableCollection.update({x: 1}, {$inc: {x: 1}}));
        }
    };
}());