Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

clone mongodb database to local machine

# Dump remote database to a local folder
mongodump --uri "mongodb+srv://username:password@host/mydb" --out ./myfolder

# Restore the database from the folder to localhost
mongorestore --port 27017 ./myfolder

# (Restore back to the remote)
mongorestore --host=example.com --port=27017 -u username -p password --db mydb ./myFolder
 
PREVIOUS NEXT
Tagged: #clone #mongodb #database #local #machine
ADD COMMENT
Topic
Name
5+7 =