What permissions do I need to use the $indexStats?

Sometimes when I execute the following pipeline:

col.aggregate([{$indexStats: {}}])

I get this error:

not authorized on <db-name> to execute command { aggregate: "<col-name>", pipeline: [ { $indexStats: {} } ]...

What permission does my user need to be able to use the $indexStats? I tried looking here, but can’t find any.

Update - found it here, sorry:

Hi @Alex_Bjorlig,

The indexStats requires a specific action:
https://docs.mongodb.com/manual/reference/privilege-actions/#indexStats

If you don’t have it in atlas ui , I suggest you temporary add a more powerful user with built in read permission on this database.

Thanks
Pavel

2 Likes

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