1

I am getting an error when I run the query in the secondary member to record the last position from the oplog.

below is the query.

db.oplog.rs.find().sort({$natural:-1}).limit(1).next().ts

and the error I am getting is

2019-05-20T12:49:26.566+0000 E QUERY    [thread1] Error: error: {
        "operationTime" : Timestamp(1558355938, 1),
        "ok" : 0,
        "errmsg" : "not master and slaveOk=false",
        "code" : 13435,
        "codeName" : "NotMasterNoSlaveOk",
        "$clusterTime" : {
                "clusterTime" : Timestamp(1558356558, 1),
                "signature" : {
                        "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                        "keyId" : NumberLong(0)
                }
        }
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DBCommandCursor@src/mongo/shell/query.js:725:1
DBQuery.prototype._exec@src/mongo/shell/query.js:117:28
DBQuery.prototype.next@src/mongo/shell/query.js:307:5
@(shell):1:1

can someone help me to get out of this issue?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.