I usually create a copy of a database in the same cluster in the same account like this:
- DUMP THE ORIGINAL DATABASE
mongodump --uri 'mongodb+srv://ACC_USER_NAME:ACC_USER_PASSWORD@cluster0.fklgt.mongodb.net/ORIGINAL_DATABASE_NAME' --archive="DUMP_FILE_NAME" --forceTableScan
- RESTORE THE DATABASE FROM THE DUMP FILE
mongorestore --uri 'mongodb+srv://ACC_USER_NAME:ACC_USER_PASSWORD@cluster0.fklgt.mongodb.net/ORIGINAL_DATABASE_NAME' --archive="DUMP_FILE_NAME" --nsFrom='ORIGINAL_DATABASE_NAME.' --nsTo='NEW_DATABASE_NAME.'
And that works perfectly.
Now, I created a new MongoDB atlas account, and I am trying to copy the original database into the new account.
So the first step is similar:
- DUMP THE ORIGINAL DATABASE
mongodump --uri 'mongodb+srv://ORIGINAL_ACC_USER_NAME:ORIGINAL_ACC_USER_PASSWORD@cluster0.fklgt.mongodb.net/ORIGINAL_DATABASE_NAME' --archive="DUMP_FILE_NAME" --forceTableScan
- RESTORE THE DATABASE FROM THE DUMP FILE
Here I could not find which params to use.
In the first example, in the second step, the URI is like this:
mongodb+srv://ACC_USER_NAME:ACC_USER_PASSWORD@cluster0.fklgt.mongodb.net/ORIGINAL_DATABASE_NAME
So I obviously should replace
ACC_USER_NAME:ACC_USER_PASSWORD
with
NEW_ACC_USER_NAME:NEW_ACC_USER_PASSWORD
But, what about the ORIGINAL_DATABASE_NAME, I could not find an equivalent to put there.
The rest of the params:
--archive="DUMP_FILE_NAME" --nsFrom='ORIGINAL_DATABASE_NAME.' --nsTo='NEW_DATABASE_NAME.'
should remain the same.