无法使用Mongodb协议在Azure DocumentDb中创建索引 [英] Cannot create index in Azure DocumentDb with Mongodb protocol

查看:83
本文介绍了无法使用Mongodb协议在Azure DocumentDb中创建索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我知道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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆