diff options
author | Ryan Timmons <ryan.timmons@mongodb.com> | 2020-06-08 12:57:04 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-08 17:09:57 +0000 |
commit | 61010cb70fd63bafe4da7e58a1829e0c5538ca46 (patch) | |
tree | f6c608a2866cdb88b2394b2bc6c8fb2a4368ee07 /jstests/noPassthroughWithMongod/insertOne_vs_insert.js | |
parent | 6f8fa936c66d2b0f70107e8a5cf7bc26f2e409be (diff) | |
download | mongo-61010cb70fd63bafe4da7e58a1829e0c5538ca46.tar.gz |
SERVER-47409 writeconcern>1 gives no error on standalone server
Diffstat (limited to 'jstests/noPassthroughWithMongod/insertOne_vs_insert.js')
-rw-r--r-- | jstests/noPassthroughWithMongod/insertOne_vs_insert.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/jstests/noPassthroughWithMongod/insertOne_vs_insert.js b/jstests/noPassthroughWithMongod/insertOne_vs_insert.js new file mode 100644 index 00000000000..bbdcc0563b8 --- /dev/null +++ b/jstests/noPassthroughWithMongod/insertOne_vs_insert.js @@ -0,0 +1,13 @@ +// Test insert and insertOne with write-concerns other than {w:1}. + +const coll = db.testInserts; +coll.drop(); + +const thrown = assert.throws(() => coll.insertOne({a: 1}, {w: 2})); +assert(thrown instanceof WriteCommandError); + +const insertResult = coll.insert({a: 2}, {w: 2}); +assert(insertResult instanceof WriteCommandError); +assert.eq(insertResult.message, "cannot use 'w' > 1 when a host is not replicated"); + +assert.eq(coll.count(), 0); |