Running admin commands on secondary mongodb server

You have to let your session know that reading this information from a non-primary server is OK (literally)…

-bash-4.1$ mongo
rs1:SECONDARY> show dbs
2018-02-01T10:37:58.457-0500 E QUERY    [thread1] Error: listDatabases failed:{
        "operationTime" : Timestamp(1517499476, 1),
        "ok" : 0,
        "errmsg" : "not master and slaveOk=false",
        "code" : 13435,
        "codeName" : "NotMasterNoSlaveOk",
        "$clusterTime" : {
                "clusterTime" : Timestamp(1517499476, 1),
                "signature" : {
                        "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                        "keyId" : NumberLong(0)
                }
        }
} :
[email protected]/mongo/shell/utils.js:25:13
Mongo.prototype.getDB[email protected]/mongo/shell/mongo.js:65:1
[email protected]/mongo/shell/utils.js:813:19
[email protected]/mongo/shell/utils.js:703:15
@(shellhelp2):1:1
rs1:SECONDARY> rs.slaveOk()
rs1:SECONDARY> show dbs
admin             0.000GB
config            0.000GB
local             0.001GB
mongoengine_test  0.004GB
rs1:SECONDARY>