Search code examples
node.jsmongodbmigrationembeddingnosql

Migrating using mongify


I'm using mongify to migrate a mysql database into mongodb.

Doing that, 2 questions appeared:

1- How can i declare my translation file in order to have a embedded array of ids that references to the objects (that are stored in a different collection and can be retrieved through populate), instead of just embedding as json objects.

2- Embedded objects can have an unique id as objects in colections do?. On other projects i've used that approach to query for embedded objects, but if that id is not present i should use a different field.


Solution

  • Unfortunately the first request isn't possible with Mongify at the moment, it requires a custom script to do that. I could give you more details if you want to send me your translation file (Make sure to remove any sensitive data).

    As for number two, the embedded object will get a unique ID. You don't need to do anything special.

    Hope that answers your questions.