Using the Migrate library to demo how to manage index's.
docker-compose up -d
-- Starts a mongo database through docker.- Open compass and connect to
mongodb://mongo:mongo@localhost:33157
. - Run
npm run up
to apply all the changes. - Run
npm run down -- 1592762974021-example-collection-remove-test-doc.js
to revert the last change.
npm run create -- name-of-the-migration
.
npm run list
.
docker-compose rm -v
.- Delete the
.migrate
file which stores the migrations applied to the database. docker-compose up -d
- if you want to start fresh.