I have two mongodbs in different server, both start with --auth. Now I want to copy a db from one server to another.
> mongo
> use admin
&
The following worked for me to copy from Ubuntu Server to another Ubuntu Server, both running MongoDB v4+:
ssh -fN -L 27018:127.0.0.1:27017
mongodump/mongorestore pipeline: mongodump --port 27018 --db --username --password --archive | mongorestore --username --password --archive
mongo --authenticationDatabase "admin" -u -p
show dbs
Check if your database exists in the list.