2013-05-20 10:37:26 -04:00
|
|
|
// This test checks that w:"majority" works correctly on a lone mongod
|
|
|
|
|
|
2015-09-22 11:40:43 -04:00
|
|
|
// set up a mongod and connect
|
2025-08-28 15:11:44 -04:00
|
|
|
let mongod = MongoRunner.runMongod({});
|
2013-05-20 10:37:26 -04:00
|
|
|
|
2015-09-23 22:36:21 -04:00
|
|
|
// get db and collection, then perform a trivial insert
|
2016-02-04 12:30:42 -05:00
|
|
|
const db = mongod.getDB("test");
|
2013-05-20 10:37:26 -04:00
|
|
|
let col = db.getCollection("single_server_majority");
|
|
|
|
|
col.drop();
|
2014-03-03 11:27:18 -05:00
|
|
|
|
2015-09-23 22:36:21 -04:00
|
|
|
// see if we can get a majority write on this single server
|
2025-08-21 10:17:44 -07:00
|
|
|
assert.commandWorked(col.save({a: "test"}, {writeConcern: {w: "majority"}}));
|
2023-04-26 17:50:58 +00:00
|
|
|
MongoRunner.stopMongod(mongod);
|