Reputation: 89
I'm trying to copy a database from a server (to which I'm connected through ssh) to my localhost. But all that I find is using the copyDatabase()
method which is now deprecated, and the documentation doesn't explain how to do something similar (Or I didn't understand how to)
Also, I'd like to know how can I generalize that to also copy a DB from atlas if it's possible.
Upvotes: 0
Views: 475
Reputation: 6629
Upvotes: 0
Reputation: 120
If you are using mongodb then its like
step 1: create a tunnel
ssh username@yourdomainOrIP -L 27017:localhost:27017
step 2 :
mongo
use admin
db.copyDatabase(<fromdb>,<todb>,"localhost:27017",<username>,<password>)
Upvotes: 2