Skip to main content

I was trying to add a MongoDB Atlas connection and on clicking the test connection button, I am getting an error “unauthorized] not authorized on local to execute command”. I tested the connection string and credentials in Mongo Compass and there it was working fine. So, I could not understand why the test connection is failing. After many tries, I just thought of saving the connection as it is and try it in the pipeline. Magically when used in the pipeline I was able to fetch the data from MongoDB. Then again when I tried the test connection and was getting the same error.

Can anyone help me understand this behavior. 

Could you please ,provide the connection String Details And also Ensure the connection String Below i Mention in pic 
 

 


Hi Lakshmi,

Please take a look at the below screenshot, on clicking the test connection(MongoDB Atlas) I am getting the below error. If I save this as it is then it’s working in the pipeline. I am able to consume data using this connection.

Regards,
Dixit


Hi Lakshmi,

Please take a look at the below screenshot, on clicking the test connection(MongoDB Atlas) I am getting the below error. If I save this as it is then it’s working in the pipeline. I am able to consume data using this connection.

Regards,
Dixit

@dixit.singla  could You please Provide a Database name at end Of connection String and then test .
in my case I used Data base name as /test .its working good .
example:
mongodb://Tamilarasu:Tamilarasu@clusterd.ehqgzvm.mongodb.net /test
/test: This is the name of the database to connect to. In this example, it's connecting to a database named "test". If this part is omitted, the connection will be made to the default database.
then Ensure the User privileges and credentials ,Database selection ,cluster configuration.

 

 

 

 


@lakshmi_narayanan_t  I have tried adding the database name at the end but still getting the same error.

 

 


@lakshmi_narayanan_t  I have tried adding the database name at the end but still getting the same error.

 

 

@dixit.singla lastly check the user roles. By using MongoDB shell execute command use admin ,show users. Then modify if required .


Reply