Today I can open a connection to a mongodb secondary like this:
PS C:\Program Files\MongoDB\Server\4.2\bin\mongo.exe
rs0:SECONDARY> db.collection.find()
Error: error: { "ok" : 0, "errmsg" : "not master and slaveOk=false", "code" : 13435 }
If I run the rs.slaveOk(), then my queries work.
If I close the session, and start a new one, my queries don’t work again.
How can I make the change of slaveOk() permanent, so any new connection made to a slave is allowed to read?