Reputation: 1871
I am using node js and i previously used to work using knex in my applications. In knex we create migrations to define the structure of the tables initially.
Is there something like this in mongoose to create schemas and seed initial data?
Upvotes: 1
Views: 95
Reputation: 174
There are two strategies:
The second one is much more code-dependent and must stay in your codebase. If the code is somehow removed, then many of documents are not upgradeable.
For instance, if there have been 3 versions of a document, [1, 2, and 3] and we remove the upgrade code from version 1 to version 2, any documents that still exist as version 1 are not upgradeable. I personally see this as overhead to maintaining code and it becomes inflexible.
I hope the following reference link would help you out.
Upvotes: 1