简体   繁体   中英

Mongo db import / export Object id overwritten

In my Mongo DB I have a number of collections that reference each other using the auto generated unique Object id eg ObjectId("5459a7fb3fcd7efe772c0816");

Now, that's all fine.

I'm currently developing on the site on two different setups, importing / exporting my collections in order to format the data and keep it in sync. When doing so new Object Ids are created disregarding the existing ones. This causes the app to break since my application references ids across different collections.

Would it be better for me to create my own id and disregard the Object id? Or is there an entirely different approach all together?

The answer to this question is: Read the documentation! http://docs.mongodb.org/manual/tutorial/backup-with-mongodump/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM