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.