MongoServerError: not authorized on admin to execute command when resizing oplog

Hi, I am trying to resize the oplog and increase the min retention hrs of my Atlas cluster (M30) via db.adminCommand in the mongosh shell, but am receiving MongoServerError: not authorized on admin to execute command... . The user I’m connecting with has the ‘atlasAdmin’ and ‘dbAdminAnyDatabase’ roles.

I have also attempted to grant the ‘clusterAdmin’ role to the user via db.grantRolesToUser but receive the same authorization error.

Any help in achieving the aim of reconfiguring the oplog settings would be much appreciated, thanks.

You may be running the command on admin db
oplog is a collection under local db
You have to switch to local db
Also there are unsupported commands on Atlas clusters
Check mongo documentation

Thanks for the reply, in end I was able to set the minimum oplog window by editing the cluster config in the Atlas UI as per dos here

1 Like

Thanks for posting your solution Nye.

For reference, if you attempted to use the replSetResizeOplog then this is listed as one of the Unsupported Commands in M10+ Clusters.


Thanks Jason, yes I was using replSetResizeOplog so that explains it.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.