Skip to content

Instantly share code, notes, and snippets.

@ashutosh1919
Created September 21, 2020 06:23
Show Gist options
  • Save ashutosh1919/55d113adc60a671bfcbeb62ec3367434 to your computer and use it in GitHub Desktop.
Save ashutosh1919/55d113adc60a671bfcbeb62ec3367434 to your computer and use it in GitHub Desktop.
init-db.js for pre-populating data in MongoDB running in Docker Container
db = db.getSiblingDB("animal_db");
db.animal_tb.drop();
db.animal_tb.insertMany([
{
"id": 1,
"name": "Lion",
"type": "wild"
},
{
"id": 2,
"name": "Cow",
"type": "domestic"
},
{
"id": 3,
"name": "Tiger",
"type": "wild"
},
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment