-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: mongodump, mongorestore
-
None
-
Platforms 2016-11-21, Platforms 2017-01-23
-
v3.4
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”}})
- is related to
-
TOOLS-1538 Running mongodump and mongorestore does not restore original index version
- Closed