Local DB not authorised on oplog.rs

Hi,

I am trying to access the oplog.rs collection and I get:

MongoServerError: not authorized on local to execute command { aggregate: “oplog.rs”, pipeline: [ { $match: {} }, { $group: { _id: 1, n: { $sum: 1 } } } ], cursor: {},…

I gave dbAdmin on local DB to that user and it looks like not enough, what should I do?

I want to get some information about my change Stream like:
count(), count with conditions (to see how many documents are left to the change stream working on),

I don’t think dbadmin has access to opslog.rs.You have to create a role with read on local db and find action on that collection or give a more privileged built in role who has access to system collections of local db

I found it apparently, it’s the “cluster monitoring” role that should be granted here to be able to query from oplog

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.