diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2017-05-12 17:15:19 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2017-06-21 09:02:07 -0400 |
commit | 7e5ab840e8aa7627d5969ca53ee46d3fb615bc6a (patch) | |
tree | 43e5c1bcfd6ed0b5962dfd5911adc6d3116a6709 /jstests/sharding/shard_collection_basic.js | |
parent | 5dd64f88d2b66078c957eea5a7889076ee5956b6 (diff) | |
download | mongo-7e5ab840e8aa7627d5969ca53ee46d3fb615bc6a.tar.gz |
SERVER-29107 move shardCollection logic into new _configsvrShardCollection command on config server
Diffstat (limited to 'jstests/sharding/shard_collection_basic.js')
-rw-r--r-- | jstests/sharding/shard_collection_basic.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/jstests/sharding/shard_collection_basic.js b/jstests/sharding/shard_collection_basic.js index e9786c5bb4e..5a4d256100c 100644 --- a/jstests/sharding/shard_collection_basic.js +++ b/jstests/sharding/shard_collection_basic.js @@ -81,10 +81,19 @@ assert.commandFailed( mongos.adminCommand({shardCollection: kDbName + '.foo', key: {aKey: "hahahashed"}})); - // Error if a collection is already sharded. + // Succeed if a collection is already sharded with the same options. + assert.commandWorked(mongos.adminCommand({shardCollection: kDbName + '.foo', key: {_id: 1}})); assert.commandWorked(mongos.adminCommand({shardCollection: kDbName + '.foo', key: {_id: 1}})); - assert.commandFailed(mongos.adminCommand({shardCollection: kDbName + '.foo', key: {_id: 1}})); + // Fail if the collection is already sharded with different options. + // different shard key + assert.commandFailed(mongos.adminCommand({shardCollection: kDbName + '.foo', key: {x: 1}})); + // different collation + assert.commandFailed(mongos.adminCommand( + {shardCollection: kDbName + '.foo', key: {_id: 1}, collation: {locale: "simple"}})); + // different 'unique' + assert.commandFailed( + mongos.adminCommand({shardCollection: kDbName + '.foo', key: {_id: 1}, unique: true})); mongos.getDB(kDbName).dropDatabase(); |