无法使用Mongodb协议在Azure DocumentDb中创建索引 [英] Cannot create index in Azure DocumentDb with Mongodb protocol
问题描述
现在我知道DocumentDb不支持唯一索引,但是为什么我不能使用createIndex()创建普通索引?在mongo shell中:
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"
}
]
我还在此处找到了Mongodb API兼容性幻灯片.它告诉我们可以在mongodb中使用createIndex函数创建非唯一索引.有人可以告诉我为什么吗?
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?
推荐答案
默认情况下,带有MongoDB API的DocumentDB会自动为所有属性编制索引,以降低设置的复杂性.我们计划在接下来的几个版本中发布创建/更新索引.
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.
这篇关于无法使用Mongodb协议在Azure DocumentDb中创建索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!