I have a MongoDB Atlas cluster within which I am trying to simply copy a database within the same instance. Unfortunately, every time I try to run db.copyDatabase() or copydb ad
just use this version and then copy its link and replace the username and password from your mongodb atlas that have the permision to read and write and it will connect i was also having the same problem spent a lot of time to solve this then i tries 2.2.12 version and it workerd.
One other cause of this error is being logged in as a different user than the one who started the bad op -- to use db.killOp
you need to be logged into the mongo shell as the same user who started the operation.
On Atlas, database users can utilize the
db.killOp()
command to kill their own operations. You are correct that an account with atlasAdmin privileges cannot kill operations on the cluster that were not initiated by that account.If you authenticate in the mongo shell with the user that the application used to initiate the offending operations, you should then be able to use db.killOp() to kill said operations.
(source is atlas support ticket)
In case you have been using mongoose, I solved a similar error updating mongoose to latest version (based on this post).
In my case I had this issue while trying to connect to mongodb atlas.I removed the error by removing these from the mongdb uri string . ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true
Original link : mongodb+srv://username:password@hostname/dbname?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true
After rectification : mongodb+srv://username:password@hostname/dbname
I ended up asking this question to MongoDB University discussion board. In case anyone comes across this, this is apparently because I am using a free cluster.
This drove me insane... Turns out the standard link provided by MongoDB was trying to name my default database "admin". Change the link from
mongodb+srv://username:password@portfoliosite-ezeot.mongodb.net/**admin**?retryWrites=true&w=majority
to
mongodb+srv://username:password@portfoliosite-ezeot.mongodb.net/**test**?retryWrites=true&w=majority
You can put any word in for test just not admin. Hope this helps!