2

I'm trying to connect my server to my MongoDB database in production,

But When I try to do that :

mongoose.connect("mongodb://user:randompassword@ds011452.mlab.com:11452/dbname?authSource=dbWithUserCredentials");

I get a

connection error: { [MongoError: auth failed] name: 'MongoError', ok: 0, errmsg: 'auth failed', code: 18 }

note : my dbname is the same as the username...

Any IDeas ?

F4Ke
  • 1,631
  • 1
  • 20
  • 49

1 Answers1

0

I've find my answer :

I've upgraded mongoDB to the 3.0 version,

and after that I've upgraded mongoose to the > 4.3.0 version

http://mongoosejs.com/docs/compatibility.html

and It works !

edit :

after update mongoDB to 3.0 (I used brew)

package.json  
->
  "dependencies": {
    "mongoose": "~4.3.0",
    ...

then npm install

F4Ke
  • 1,631
  • 1
  • 20
  • 49