Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse-Server mongoerror authentication failed

I setup a local parse-server, it is working perfectly fine except when I enable authentication in MongoDB and change connection string to mongodb://username:password@localhost:27017/dbname, the parse console throw the following error:

unable to ensure uniqueness for usernames mongoerror authentication failed

The client i.e. RoboMongo works fine too, with authentication. I even tried with a user that has both userAdminAnyDatabase and dbAdminAnyDatabase roles assigned to it just to ensure it is not a permission issue.

Update: I was using MongoDB 3.2 so I tried to downgrade to MongoDB 3.0.12, still the same issue.

Update 2: I even tried root role which has the highest privilege i.e. superuser but still no luck.

like image 914
Sohail Ahmed Avatar asked Aug 02 '16 17:08

Sohail Ahmed


1 Answers

Have you created a user for the specific database? If you try to connect using the mongo admin account you can experience this.

Create a user like this:

use dbName
db.createUser({ user: "userName", pwd: "password", roles: [ "readWrite", "dbAdmin" ] })

and use that to connect to the database - then it should work

like image 115
Simon Avatar answered Sep 19 '22 11:09

Simon