Getting Error From MongoAtlas user is not allowed to do action [listCollections] on [DBName.]

Hi,

I am facing this issue when trying to connect to my mongodb atlas

user is not allowed to do action [listCollections] on [server.].

It works fine on my local device, but when I try running on Azure App Service I am getting this error.

System & Build Info:
Spring Boot Application
Java 11
JDO Data Nucleus 6.0

I have added whitelist ip and also excluded the mongodb auto configuration classes in spring boot application annotation.

Really stuck, not sure what else am I missing.

Hi @Raymond_Nathan, thanks for posting!

The M150 course is meant to be completed on MongoDB University, so Azure App Service is not necessary. I am mainly writing this for other learners who stumble on this post – you do not need to use Azure or Spring Boot :slight_smile:

However, I can try to troubleshoot your issue. It looks like you are trying to read from the collections on the server. database.

Do you have:

  1. A user created on Atlas that has permission to read from this database?
  2. The credentials for that user configured in the Azure App Service (or in the Sprint Boot Application, if that’s where the MongoDB connection info is)?

I hope this helps! Sorry I don’t have a lot of experience with Azure App Service.

Thanks,
Matt

1 Like

Hi Matt,

Thanks for getting back so quickly. Actually I have managed to resolve the issue.

It was a combination of multiple reasons:

  1. I needed to maintain ip whitelist mongodb atlas.
  2. Properties maintained in Azure were not being passed to the application, so had to troubleshoot that.
  3. Also the classes were not properly enhanced by (DataNucleus) due to wrong phase I set them in.

Fixed up all those and working great now. :slight_smile:

Regards,
Raymond

In the Atlas cluster, click “Database Access” under “SECURITY” on the left sidebar,
Click on the button Edit and then add a role atlasAdmin@admin to the user.
Try again or refresh your connection to see the result.

2 Likes