Details
-
Bug
-
Resolution: Duplicate
-
Minor - P4
-
None
-
3.6.8, 4.0.3
-
None
-
Sharding
-
ALL
-
Description
When sharding a collection with a hashed shard key but including invalid options will output the following error:
mongos> sh.shardCollection("test.foo", {_id:"hashed"}, {pieinthesky:1})
|
{
|
"ok" : 0,
|
"errmsg" : "Hashed shard keys cannot be declared unique. It's possible to ensure uniqueness on the hashed field by declaring an additional (non-hashed) unique index on the field.",
|
"code" : 72,
|
"codeName" : "InvalidOptions",
|
"operationTime" : Timestamp(1541185291, 4),
|
"$clusterTime" : {
|
"clusterTime" : Timestamp(1541185291, 4),
|
"signature" : {
|
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
|
"keyId" : NumberLong(0)
|
}
|
}
|
}
|
The problem is my invalid option, not the hashed shard key.
Attachments
Issue Links
- duplicates
-
SERVER-37908 Improve the interface of `sh.shardCollection`
-
- Closed
-