Cannot create index in Azure DocumentDb with Mongodb protocol

冷暖自知 提交于 2020-01-11 05:06:05

问题


Now I know that the Unique Index is not supported in DocumentDb, but why I cannot create a normal index using createIndex()? In mongo shell:

> db.product.createIndex({itemId:1})
{ "_t" : "OKMongoResponse", "ok" : 1 }

but the collection seems unchange:

> db.product.getIndexes()
[
{
    "v" : 1,
    "key" : {
        "_id" : 1
    },
    "name" : "_id_1",
    "ns" : "admin.product"
}
]

I also find Mongodb API Compatibility slide here. It told us that we can use createIndex function in mongodb to create non-unique index. Does anybody could tell me why?


回答1:


By default, DocumentDB with API for MongoDB automatically indexes all properties to reduce the setup complexity. We plan to release creating / updating indexes in the next couple releases.




回答2:


I think indexes are not supported at the moment (27/02/2017). Hopefully, future releases will support them.



来源:https://stackoverflow.com/questions/42480874/cannot-create-index-in-azure-documentdb-with-mongodb-protocol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!