Query errors when connecting to Atlas

I am using a Java Driver 3.12.0 to connect to Mongo Atlas Free Tier. I get an error “Query failed with error code 8000 and error message 'user is not allowed to do action” when trying to run a simple query

String connectString = "mongodb+srv://username:password@cluster.mongodb.net/kchange?ssl=true&retryWrites=true&w=majority";
MongoClientSettings settings =
        .applyToConnectionPoolSettings(builder ->
                builder.maxSize(15).minSize(10).maxConnectionIdleTime(6000, TimeUnit.SECONDS))
        .applyToClusterSettings(builder ->
                builder.applyConnectionString(new ConnectionString(connectString)))
        .applyToSslSettings(builder -> builder.enabled(true))
        .applyToSocketSettings(builder -> {
            builder.connectTimeout(100, TimeUnit.SECONDS);
            builder.readTimeout(100, TimeUnit.SECONDS);

When i connect without using the MongoClientSettings object then it seems to work fine

Any pointers ?

It means user is not having enough privileges
What command you were running?
Does it run with shell?
Also M0 cluster has some restrictions.Some admin commands cannot be run