I'm building an API with NodeJS, express and MongoDB. Before setting up post/put requests, I wanted to enforce a schema for the documents contained inside my collection and that's where the issue arises:
user is not allowed to do action [collMod] on [db-name.collection-name]
I have also tried to add collMod
manually but nothing changed:
user is not allowed to do action [collMod] on [db-name.collection-name]
Finally, I have tried to enforce a schema via mongosh
but encountered the same issue:
user is not allowed to do action [collMod] on [db-name.collection-name]
I have tried checking the admin permissions and everything seems to be fine there too.
In order to solve the problem, you have to open your MongoDB Atlas and update Admin settings: it's not enough to have Read and write to any database
role - you need to update it to: Atlas admin
.
In order to do so, follow the steps:
Atlas Admin
> Update UserWait for up to 30 seconds for the changes to be saved.