Answers for "mongodb copy database from remote to local"

1

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
Posted by: Guest on December-19-2020
-2

mongodb copy database from remote to local

db.copyDatabase("DATABASENAME", "DATABASENAME", "localhost:27018");
Posted by: Guest on November-09-2020

Code answers related to "mongodb copy database from remote to local"

Browse Popular Code Answers by Language