Minimal roles/privileges for a mongoDb user in order to be able to create new databases

53 Views Asked by At

I am writing a program that operates on one main mongoDb but may create new mongo databases.

I am trying to figure out what are the minimal rights that the mongoDbUser (used by my program) needs in order to be able to create new databases and have readWrite access to the databases it has created.

1

There are 1 best solutions below

0
On BEST ANSWER

Your mongoDbUser user needs the role: readWriteAnyDatabase.

From the docs:

readWriteAnyDatabase

Provides the same read and write privileges as readWrite on all databases except local and config. readWriteAnyDatabase also provides the listDatabases privilege action on the cluster.