How can I transfer a mongodb database to another machine that cannot see the first one

If you’re using Ubuntu/Linux, run the following commands. First, mongodump on the origin server:

mongodump --db DataBaseName

Copy the generated dump/DataBaseName folder to the new machine. Then, import using mongorestore:

mongorestore --db DataBaseName /path/to/DataBaseName 

Note that /path/to/DataBaseName should be a directory filled with .json and .bson representations of your data.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)