summaryrefslogtreecommitdiff
path: root/jstests/replsets/bulk_api_wc.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/replsets/bulk_api_wc.js')
-rw-r--r--jstests/replsets/bulk_api_wc.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/jstests/replsets/bulk_api_wc.js b/jstests/replsets/bulk_api_wc.js
index 4b029555ce1..3c9d3b27538 100644
--- a/jstests/replsets/bulk_api_wc.js
+++ b/jstests/replsets/bulk_api_wc.js
@@ -35,13 +35,27 @@ var executeTests = function() {
});
//
+ // Fail due to unrecognized write concern field.
+ coll.remove({});
+ var bulk = coll.initializeOrderedBulkOp();
+ bulk.insert({a: 1});
+ bulk.insert({a: 2});
+ var result = assert.throws(function() {
+ bulk.execute({x: 1});
+ });
+ assert.eq(ErrorCodes.FailedToParse, result.code, 'unexpected error code: ' + tojson(result));
+ assert.eq('unrecognized write concern field: x',
+ result.errmsg,
+ 'unexpected error message: ' + tojson(result));
+
+ //
// Fail with write error, no write concern error even though it would fail on apply for ordered
coll.remove({});
var bulk = coll.initializeOrderedBulkOp();
bulk.insert({a: 1});
bulk.insert({a: 2});
bulk.insert({a: 2});
- var result = assert.throws(function() {
+ result = assert.throws(function() {
bulk.execute({w: 'invalid'});
});
assert.eq(result.nInserted, 2);