'autoIndexID'不是有效的收集选项-mongoDB [英] 'autoIndexID' is not a valid collection option - mongoDB

查看:47
本文介绍了'autoIndexID'不是有效的收集选项-mongoDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在我的MongoDB上运行它时:

When I try to run this on my MongoDB:

db.createCollection("mycol", { capped : true, autoIndexID : true, size : 6142800, max : 10000 } )

我明白了:

{
    "ok" : 0,
    "errmsg" : "The field 'autoIndexID' is not a valid collection option. Options: { capped: true, autoIndexID: true, size: 6142800.0, max: 10000.0 }",
    "code" : 72,
    "codeName" : "InvalidOptions"
}

我不明白...对不起,如果它愚蠢. :/

I just don't get it... Sorry if it's dumb. :/

推荐答案

autoIndexId选项已在3.4中删除,在3.2中已弃用

autoIndexId option has been removed in 3.4 and was already deprecated in 3.2

来自 mongo doc

自版本3.2起不推荐使用:autoIndexId选项将被删除 在3.4版中.

Deprecated since version 3.2: The autoIndexId option will be removed in version 3.4.

此外,对于上限集合:

上限集合具有_id字段和_id字段上的索引,通过 默认.

Capped collections have an _id field and an index on the _id field by default.

这篇关于'autoIndexID'不是有效的收集选项-mongoDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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