I use mongocxx 3.6.1 for mongodb access in C++ app. Due to the db administration rules, the app connects to mongodb without the permission to admin db. The app needs to get the replica set info such as which server is primary and which is secondary. When the app calls { replSetGetStatus : 1 } by database::run_command(), the call fails with the error “not authorized on admin to execute command”.
I wonder if there is a way to get the replica set status without admin permission.