Guides
Migrating the Database
Learn how to migrate your local MongoDB database
We use migrate-mongo to handle our MongoDB database migrations.
The database has gone through a number of migrations since the beginning of this project. To ensure that local testing data is the same shape as the data in the production MongoDB database, run all MongoDB migration scripts with the following command:
Generate a New Migration script
Globally install migrate-mongo
to be able to generate migration scripts.
Replace <name_of_migration>
with the name of your own migration. Remember to use snake case.
Structure of MongoDB Migration
Each migration script must include an up
and down
function that are included in the default exports.
migrations/20201106045436-name-of-migration.js
Here are all the examples of database migrations for the Igbo API.