mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 01:21:03 +01:00
21 lines
581 B
JavaScript
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);
|
||
|
})();
|