command SON([('saslStart', 1), ('mechanism', 'SCRAM-SHA-1'), ('autoAuthorize', 1), ('payload', Binary('n,,n=jgordon,r=OTU1MzY4NDg1MDI5', 0))]) on namespace MYDATABASE.$cmd failed: Authentication failed.Does any one know what i'm doing wrong? any ideas?
Thanks a lot,
Juan
Does any one know what i’m doing wrong? any ideas?
Hi Juan,
You should be able to connect via mongoengine to MongoDB Atlas using MongoDB Connection String URI format such below:
from mongoengine import connect
connection_uri = "mongodb://[username:password@]@server1.mongodb.net:27017,server2.mongodb.net:27017,server3.mongodb.net:27017/databaseName?ssl=true&replicaSet=replicaSetName&authSource=admin"
connect('alias', host=connection_uri)
The above was tested using current version of mongoengine v0.10.6.
but i can’t, i’m only able to connect to the admin database
Could you confirm that you can connect using mongo shell and you have the required access to the database ? For example:
mongo "mongodb://[username:password@]@server1.mongodb.net:27017,server2.mongodb.net:27017,server3.mongodb.net:27017/admin?ssl=true&replicaSet=replicaSetName" --username [username]--password [password] --ssl
Then type on the mongo shell:
admin. If you are still having trouble with MongoDB Atlas, please raise an issue on MongoDB Atlas Support page - while logged in on Atlas cluster page, follow the ‘Support’ link on the bottom left hand corner.
Regards,
Wan.