diff options
Diffstat (limited to 'jstests/sharding/update_immutable_fields.js')
-rw-r--r-- | jstests/sharding/update_immutable_fields.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/jstests/sharding/update_immutable_fields.js b/jstests/sharding/update_immutable_fields.js index e90ecb7e037..7f82d84600b 100644 --- a/jstests/sharding/update_immutable_fields.js +++ b/jstests/sharding/update_immutable_fields.js @@ -1,7 +1,7 @@ // Tests that updates can't change immutable fields (used in sharded system) var st = new ShardingTest({shards : 2, mongos : 1, - verbose : 0}) + verbose : 0}); st.stopBalancer(); var mongos = st.s; @@ -9,9 +9,9 @@ var config = mongos.getDB("config"); var coll = mongos.getCollection(jsTestName() + ".coll1"); var shard0 = st.shard0; -printjson(config.adminCommand({enableSharding : coll.getDB() + ""})) +printjson(config.adminCommand({enableSharding : coll.getDB() + ""})); st.ensurePrimaryShard(coll.getDB().getName(), 'shard0000'); -printjson(config.adminCommand({shardCollection : "" + coll, key : {a : 1}})) +printjson(config.adminCommand({shardCollection : "" + coll, key : {a : 1}})); var getDirectShardedConn = function( st, collName ) { @@ -34,23 +34,23 @@ var getDirectShardedConn = function( st, collName ) { assert.commandWorked( shardConnWithVersion.getDB( "admin" ).runCommand( ssvInitCmd ) ); return shardConnWithVersion; -} +}; var shard0Coll = getDirectShardedConn(st, coll.getFullName()).getCollection(coll.getFullName()); // No shard key -shard0Coll.remove({}) +shard0Coll.remove({}); assert.writeError(shard0Coll.save({ _id: 3 })); // Full shard key in save assert.writeOK(shard0Coll.save({ _id: 1, a: 1 })); // Full shard key on replacement (basically the same as above) -shard0Coll.remove({}) +shard0Coll.remove({}); assert.writeOK(shard0Coll.update({ _id: 1 }, { a: 1 }, true)); // Full shard key after $set -shard0Coll.remove({}) +shard0Coll.remove({}); assert.writeOK(shard0Coll.update({ _id: 1 }, { $set: { a: 1 }}, true)); // Update existing doc (replacement), same shard key value @@ -66,7 +66,7 @@ assert.writeError(shard0Coll.update({ _id: 1 }, { b: 1 })); assert.writeError(shard0Coll.update({ _id: 1 }, { $unset: { a: 1 }})); // Error due to removing all the embedded fields. -shard0Coll.remove({}) +shard0Coll.remove({}); assert.writeOK(shard0Coll.save({ _id: 2, a: { c: 1, b: 1 }})); |