0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
mongodb/jstests/noPassthrough/session_w0.js
2019-01-15 18:06:46 -05:00

21 lines
581 B
JavaScript

/**
* Explicit shell session should prohibit w: 0 writes.
*/
(function() {
"use strict";
const conn = MongoRunner.runMongod();
const session = conn.startSession();
const sessionColl = session.getDatabase("test").getCollection("foo");
const err = assert.throws(() => {
sessionColl.insert({x: 1}, {writeConcern: {w: 0}});
});
assert.includes(err.toString(),
"Unacknowledged writes are prohibited with sessions",
"wrong error message");
session.endSession();
MongoRunner.stopMongod(conn);
})();