Skip to content

Instantly share code, notes, and snippets.

@pavittarx
Created October 6, 2021 16:25
Show Gist options
  • Save pavittarx/8d5cd75d4f88558bb4c719d0959687ae to your computer and use it in GitHub Desktop.
Save pavittarx/8d5cd75d4f88558bb4c719d0959687ae to your computer and use it in GitHub Desktop.
  1. Login to your Local/Remote MongoDb instance via MongoDb Compass.
  2. Save the file data.json on your system.
  3. Create a new Database & Collection.
  4. Click Import Data and upload data.json you saved locally.
  5. Your documents should be loading and ready to go.

You can also see visual previews here. https://docs.mongodb.com/compass/current/import-export/

[{
"name": "Stuart",
"hobbies": ["Running", "Walking", "Jumping"],
"friends": [{
"name": "Danny",
"date": "2021-10-05"
}, {
"name": "Ralph",
"date": "2021-10-02"
}, {
"name": "Sunny",
"date": "2021-09-25"
}, {
"name": "Ronny",
"date": "2021-09-17"
}]
}, {
"name": "Harish",
"hobbies": ["Running", "Walking", "Jumping"],
"friends": [{
"name": "Subhash",
"date": "2021-09-03"
}, {
"name": "Suresh",
"date": "2021-09-25"
}, {
"name": "Aniket",
"date": "2021-09-10"
}, {
"name": "Harry",
"date": "2021-09-15"
}]
}, {
"name": "George",
"hobbies": ["Running", "Hover", "Jumping"],
"friends": [{
"name": "Trevor",
"date": "2021-10-05"
}, {
"name": "Ralph",
"date": "2021-10-02"
}, {
"name": "Sammy",
"date": "2021-09-25"
}, {
"name": "Gilbert",
"date": "2021-09-17"
}]
}, {
"name": "Samantha",
"hobbies": ["Fly", "Jump", "Play"],
"friends": [{
"name": "Ruby",
"date": "2021-10-05"
}, {
"name": "Lona",
"date": "2021-10-02"
}, {
"name": "Sunny",
"date": "2021-09-25"
}, {
"name": "George",
"date": "2021-09-17"
}]
}, {
"name": "Ruby",
"hobbies": ["Read", "Run", "Walk"],
"friends": [{
"name": "Mary",
"date": "2021-10-05"
}, {
"name": "Ralph",
"date": "2021-10-02"
}, {
"name": "Lona",
"date": "2021-09-25"
}, {
"name": "Ronny",
"date": "2021-09-17"
}]
}, {
"name": "Lona",
"hobbies": ["Sleep", "Eat", "Jumping"],
"friends": [{
"name": "Sammy",
"date": "2021-10-05"
}, {
"name": "Ralph",
"date": "2021-10-02"
}, {
"name": "Samantha",
"date": "2021-09-25"
}, {
"name": "Ronny",
"date": "2021-09-17"
}]
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment