I am logged with a user that has readWriteAnyDatabase, dbAdminAnyDatabase, userAdminAnyDatabase, clusterAdmin but still can not copy database. I am able to access and create collections in both databases individually.
> use admin
> db.auth('user', 'password')
> db.copyDatabase('database1', 'database2')
{ "ok" : 0, "errmsg" : "unauthorized" }
Mongodb version is 2.4.5
Starting in version 4.2, MongoDB removes the copydb command. The deprecated db.copyDatabase (), which wraps the copydb command, can only be run against MongoDB 4.0 or earlier versions. For behavior and examples, refer to the 4.0 or earlier version of the manual. For an alternative in version 4.2+, see Copy/Clone a Database.
MongoDB Enterprise m103-repl:PRIMARY> use admin MongoDB Enterprise m103-repl:PRIMARY> db.auth ("m103-admin","m103-pass") Then try initiating the replica set. And if it is already initialised, check its status using:
You may see an error in MongoDB Compass similar to the following: The most common source of this error is a missing Atlas IP whitelist entry for the public IP address where Compass is running. Ensure the public IP address where Compass is running is included in your Atlas project's IP whitelist.
This error means that the connection to your MongoDB cluster was closed before the initial setup completed. You may see an error in MongoDB Compass similar to the following: The most common source of this error is a missing Atlas IP whitelist entry for the public IP address where Compass is running.
This one will not work currently.
There is a note in the source : at https://github.com/mongodb/mongo/blob/master/src/mongo/db/cloner.cpp line 704 "Note: doesn't work with authentication enabled, except as old-style users."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With