We have all lamented, with great chagrin, the proverbial "works on my machine" problem because data is different across different development environments.
Wouldn't it be ideal if we could deploy our MongoDB database state from a single repository on all development environments?
In this tutorial, we will be dockerizing a Mongo database with some seed data so we can do just that!
- Install Docker Desktop
- Install MongoDB Compass (for testing)
- The structure should look as follows:
There we have it! Now all you have to do to reproduce your Mongo state anywhere is pull something like this from a repo onto a machine with Docker and run the commands from Step 6. You can download the complete code here: TonicMongoDockerTutorial_final.zip.
Credit to https://gist.github.com/yoobi55/5d36f13e902a75225a39a8caa5556551 for the Restaurant json data.