简体   繁体   中英

Parse to mongoDB atlas connect

I'm trying to change my parse.com connection string to a mongoDB cluster and it giving me:

Server returned error on SASL authentication step: Authentication failed.

I'm using their Connection String:

mongodb://username:PASSWORD@cluster0-shard-00-00-xxxx.mongodb.net:xxxx,cluster0-shard-00-01-xxxx.mongodb.net:xxxx,cluster0-shard-00-02-xxxx.mongodb.net:xxxx/admin?replicaSet=Cluster0-shard-0

i've added their ip(54.85.224.0/20) to the trusted ips,I'm using admin to connect. I don't know what else to do, what am i missing? I'm totally new to this so please explain to me like i'm 5!

I was having a similar issue, in my case I was trying to connect to a different DB than admin. My problem was that I was changing "/admin" to "/cars" (my DB name) in the connection string.

Customer support kindly helped me out, some facts I learned:

  • The authentication is always against the "admin" db.
  • You can specify the DB you want to use changing "/admin" to "/cars" but you have to specify the authentication db ("admin" in this case) using the "authSource" parameter in the url.

So you have to change the db name and append "&authSource=admin" to the end of your connection string.

Example:

mongodb://username:PASSWORD@cluster0-shard-00-00-xxxx.mongodb.net:xxxx,cluster0-shard-00-01-xxxx.mongodb.net:xxxx,cluster0-shard-00-02-xxxx.mongodb.net:xxxx/admin?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM