cayasso / mongo-oplog

Watch mongodb oplog in a simple way
381 stars 91 forks source link

"not authorized for query on local.oplog.rs" #26

Closed ORESoftware closed 9 years ago

ORESoftware commented 9 years ago

I got this error for the first time today in an attempt to connect to a MongoDB cluster on a Compose deployment:

image

the original code looking like:

var url = 'mongodb://abc:xyz@candidate.54.mongolayer.com:10050/app42153482';

console.log('about to tail...');
var oplog = new MongoOplog(url).tail(function (err, oplogStream) {
    if (err) {
        console.error(err);
    }
    else {
        console.log('tail event:', oplogStream);
    }
});

I did a Google but nothing obvious appears to me, know about this one?

Necromos commented 9 years ago

Error message is clearly saying that you lack access to oplog. Check out how to do this: https://docs.compose.io/common-questions/getting-oplog-access.html