summaryrefslogtreecommitdiff
path: root/jstests/readonly/write_ops.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/readonly/write_ops.js')
-rw-r--r--jstests/readonly/write_ops.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/jstests/readonly/write_ops.js b/jstests/readonly/write_ops.js
new file mode 100644
index 00000000000..bde5d231ca6
--- /dev/null
+++ b/jstests/readonly/write_ops.js
@@ -0,0 +1,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}}));
+ }
+ };
+}());