Details
-
Bug
-
Resolution: Won't Fix
-
Major - P3
-
None
-
3.6.8, 4.0.3
-
None
-
Sharding
-
ALL
-
Description
When sharding a collection with a hashed shard key, specifying documented options like numInitialChunks causes the operation to fail.
sh.shardCollection("test.foo", {_id:"hashed"}, {numInitialChunks:128})
|
{
|
"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(1541185959, 4),
|
"$clusterTime" : {
|
"clusterTime" : Timestamp(1541185959, 4),
|
"signature" : {
|
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
|
"keyId" : NumberLong(0)
|
}
|
}
|
}
|
This is because options parameter is being interpreted as the unique parameter despite the fact that the latter is optional.
Attachments
Issue Links
- is duplicated by
-
SERVER-37907 Sharding a collection with invalid options displays a misleading error
-
- Closed
-