| Steps To Reproduce: |
First create a unique index.
sh.enableSharding("testdb")
|
use testdb
|
db.testcoll.createIndex({a:1}, {unique:true})
|
db.testcoll.getIndexes()
|
[
|
{
|
"v" : 2,
|
"key" : {
|
"_id" : 1
|
},
|
"name" : "_id_"
|
},
|
{
|
"v" : 2,
|
"key" : {
|
"a" : 1
|
},
|
"name" : "a_1",
|
"unique" : true
|
}
|
]
|
Then shard the collection, but do not specify a unique index.
sh.shardCollection("testdb.testcoll", {a:1})
|
Finally, it shows that it is not a unique index in the config.collections table, but when I run getIndexes command, it shows that it is a unique index, and the status is inconsistent.
use config
|
db.collections.find({_id:"testdb.testcoll"})
|
{ "_id" : "testdb.testcoll", "lastmodEpoch" : ObjectId("63467fa468689fc229d184b2"), "lastmod" : ISODate("2022-10-12T08:49:40.375Z"), "timestamp" : Timestamp(1665564579, 6), "uuid" : UUID("e6eb4a14-60ee-4c00-acb3-355da36b59eb"), "key" : { "a" : 1 }, "unique" : false, "noBalance" : false }
|
|