Despite specifying rs.slaveOk(), db.disableFreeMonitoring() returns a "not master" error.
Original Description
I disabled free monitoring from shell on a primary node without issues. When I connect to a secondary node I see the message:
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
When I execute `db.disableFreeMonitoring()`, I'm getting the following error:
2019-03-13T18:46:43.618+0000 E QUERY [js] Error: command failed: { "operationTime" : Timestamp(1552502797, 1), "ok" : 0, "errmsg" : "not master", "code" : 10107, "codeName" : "NotMaster", "$clusterTime" : { "clusterTime" : Timestamp(1552502797, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } : _getErrorWithCode@src/mongo/shell/utils.js:25:13 doassert@src/mongo/shell/assert.js:18:14 _assertCommandWorked@src/mongo/shell/assert.js:536:17 assert.commandWorked@src/mongo/shell/assert.js:620:16 DB.prototype.disableFreeMonitoring@src/mongo/shell/db.js:1994:9 @(shell):1:1
I tried to repeat that command after "rs.slaveOk()", but I got exactly the same error.
Just in case, "db.getFreeMonitoringStatus()" returns:
{ "state" : "undecided", "ok" : 1, "operationTime" : Timestamp(1552503490, 1), "$clusterTime" : { "clusterTime" : Timestamp(1552503490, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } }