Currently, in our project, we have a schema with a referenced document.
process: { type: Schema.ObjectId, ref: 'Process' },
Now based on design we want to switch and use a subdocument
process: Process.schema,
The problem is we have some data in production and on everyone's dev server with the previous layout. How do I / what is the best way to include some migration code to alter this data? Pseudo code what I need to do is
Get all executions
loop executions
get process from execution's process ID
set execution.process to newProcess.toObject()
save execution
I know there are some general node migration tools we could employ, but is there anything recommended from Mongo? I had trouble finding anything else online with a real answer.
For context, we are also using sequelize and use their migrations for our mysql needs.
via Troy Cosentino
No comments:
Post a Comment