summaryrefslogtreecommitdiff
path: root/jstests/replsets/single_server_majority.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/replsets/single_server_majority.js')
-rw-r--r--jstests/replsets/single_server_majority.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/jstests/replsets/single_server_majority.js b/jstests/replsets/single_server_majority.js
new file mode 100644
index 00000000000..136b1213001
--- /dev/null
+++ b/jstests/replsets/single_server_majority.js
@@ -0,0 +1,15 @@
+// This test checks that w:"majority" works correctly on a lone mongod
+
+// set up a mongod and connect a mongo
+port = allocatePorts(1)[0];
+var baseName = "single_server_majority";
+var mongod = startMongod("--port", port, "--dbpath", MongoRunner.dataPath + baseName, "-v");
+var mongo = startMongoProgram("mongo", "--port", port);
+
+// get db and collection, then preform a trivial insert
+db = mongo.getDB("test")
+col = db.getCollection("single_server_majority");
+col.drop();
+// see if we can get a majority write on this single server
+assert.writeOK(col.save({ a: "test" }, { writeConcern: { w: 'majority' }}));
+