0
一個分片鑰匙我的MongoDB是一個新手,這裏是一個簡單的例子,但得到了一個錯誤:不能使用索引鍵(_id)在MongoDB中
我想用_id
場(自動生成和索引)作爲mongodb中的分片鍵,但遇到了這個錯誤。
{
"proposedKey" : {
"_id" : "hashed"
},
"curIndexes" : [
{
"v" : 1,
"key" : {
"_id" : 1
},
"name" : "_id_",
"ns" : "jackfruit.scenicspots"
},
{
"v" : 1,
"key" : {
"geoLocation" : "2dsphere"
},
"name" : "geoLocation_2dsphere",
"ns" : "jackfruit.scenicspots",
"2dsphereIndexVersion" : 2
}
],
"ok" : 0,
"errmsg" : "please create an index that starts with the shard key before sharding."
}
錯誤消息表明我已經在關鍵_id
名爲_id_
的指數,爲什麼錯誤仍時有發生?