summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/update_post_image_validation.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthrough/update_post_image_validation.js')
-rw-r--r--jstests/noPassthrough/update_post_image_validation.js40
1 files changed, 20 insertions, 20 deletions
diff --git a/jstests/noPassthrough/update_post_image_validation.js b/jstests/noPassthrough/update_post_image_validation.js
index 75d0c4ddfcf..ad78227a09b 100644
--- a/jstests/noPassthrough/update_post_image_validation.js
+++ b/jstests/noPassthrough/update_post_image_validation.js
@@ -1,28 +1,28 @@
// Verify that the update system correctly rejects invalid entries during post-image validation.
(function() {
- "use strict";
+"use strict";
- const conn = MongoRunner.runMongod();
- assert.neq(null, conn, "mongod was unable to start up");
+const conn = MongoRunner.runMongod();
+assert.neq(null, conn, "mongod was unable to start up");
- const testDB = conn.getDB("test");
+const testDB = conn.getDB("test");
- // Test validation of elements added to an array that is represented in a "deserialized" format
- // in mutablebson. The added element is invalid because it is a DBRef with a missing $id.
- assert.writeOK(testDB.coll.insert({_id: 0, a: []}));
- assert.writeErrorWithCode(
- testDB.coll.update({_id: 0}, {$set: {"a.1": 0, "a.0": {$ref: "coll", $db: "test"}}}),
- ErrorCodes.InvalidDBRef);
- assert.docEq(testDB.coll.findOne({_id: 0}), {_id: 0, a: []});
+// Test validation of elements added to an array that is represented in a "deserialized" format
+// in mutablebson. The added element is invalid because it is a DBRef with a missing $id.
+assert.writeOK(testDB.coll.insert({_id: 0, a: []}));
+assert.writeErrorWithCode(
+ testDB.coll.update({_id: 0}, {$set: {"a.1": 0, "a.0": {$ref: "coll", $db: "test"}}}),
+ ErrorCodes.InvalidDBRef);
+assert.docEq(testDB.coll.findOne({_id: 0}), {_id: 0, a: []});
- // Test validation of modified array elements that are accessed using a string that is
- // numerically equivalent to their fieldname. The modified element is invalid because it is a
- // DBRef with a missing $id.
- assert.writeOK(testDB.coll.insert({_id: 1, a: [0]}));
- assert.writeErrorWithCode(
- testDB.coll.update({_id: 1}, {$set: {"a.00": {$ref: "coll", $db: "test"}}}),
- ErrorCodes.InvalidDBRef);
- assert.docEq(testDB.coll.findOne({_id: 1}), {_id: 1, a: [0]});
+// Test validation of modified array elements that are accessed using a string that is
+// numerically equivalent to their fieldname. The modified element is invalid because it is a
+// DBRef with a missing $id.
+assert.writeOK(testDB.coll.insert({_id: 1, a: [0]}));
+assert.writeErrorWithCode(
+ testDB.coll.update({_id: 1}, {$set: {"a.00": {$ref: "coll", $db: "test"}}}),
+ ErrorCodes.InvalidDBRef);
+assert.docEq(testDB.coll.findOne({_id: 1}), {_id: 1, a: [0]});
- MongoRunner.stopMongod(conn);
+MongoRunner.stopMongod(conn);
}());