Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
None
-
None
-
Platforms 2016-11-21, Platforms 2017-01-23
-
v3.4
Description
mongodump can get the _id index spec from the listCollections output:
> db.runCommand({listCollections: 1})
|
{
|
"cursor" : {
|
"id" : NumberLong(0),
|
"ns" : "test.$cmd.listCollections",
|
"firstBatch" : [
|
{
|
"name" : "c",
|
"type" : "collection",
|
"options" : {
|
|
},
|
"info" : {
|
"readOnly" : false
|
}
|
“idIndex”: {
|
"v" : 1,
|
"key" : {
|
"_id" : 1
|
},
|
"name" : "_id_",
|
"ns" : "test.c"
|
}
|
},
|
…
|
]
|
}
|
}
|
Note that the idIndex field will not be present for views or for collections without an _id index (i.e. autoIndexId: false).
mongorestore can specify the spec for the _id index in the create command:
> db.runCommand({create: "c",
|
idIndex: {v: 1, key: {_id: 1}, name: “_id_”, ns: “test.c”}})
|
Attachments
Issue Links
- is related to
-
TOOLS-1538 Running mongodump and mongorestore does not restore original index version
-
- Closed
-