Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'autoIndexID' is not a valid collection option - mongoDB

Tags:

mongodb

When I try to run this on my MongoDB:

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

I get this:

{
    "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. :/

like image 487
Emilio Avatar asked Jan 21 '17 19:01

Emilio


2 Answers

The correct option is autoIndexId , you had put autoIndexID .

like image 166
Roger Avatar answered Nov 15 '22 20:11

Roger


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

From mongo doc and https://jira.mongodb.org/browse/SERVER-19067:

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

Also, for capped collection :

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

like image 29
Bertrand Martel Avatar answered Nov 15 '22 20:11

Bertrand Martel