I am trying to rename a database from within pymongo. I understand that the way to do this is to copy the database, then delete the original (right?), thus I am trying to run the code:
client = MongoClient(connectionString, server_api=ServerApi('1'))
client.admin.command('copydb',
fromdb=dbName,
todb=newDBName)
which I copied from there:
https://pymongo.readthedocs.io/en/stable/examples/copydb.html
The user that successfully logged in has the Built-In role Atlas Admin. However, running this code gives me an error:
OperationFailure: (Unauthorized) not authorized on admin to execute command
How is this possible, doesn’t the Atlas Admin have all the rights to do anything?