0

I have a mLab mongo database and a nodejs server set up. However, when I try to push something to the database it gives me the following error:

not authorized on DATABASE to execute command { insert: \"users\", documents: [ { _id: ObjectId('RANDOMID'), username: \"USERNAME\", email: \"EMAIL\", 1.0: 0 } ], ordered: true }"

I am the only user and I have the dbOwner role.

package.json:

{
  "name": "api",
  "version": "1.0.0",
  "private": true,
  "main": "app.js",
  "scripts": {
    "start": "node app.js"
  },
  "dependencies": {
    "express": "^4.16.3",
    "mocha": "^5.1.1",
    "mongodb": "^3.1.0-beta4",
    "mongoose": "^5.0.11",
    "pug": "^2.0.3",
    "underscore": "^1.8.3"
  }
}
1

1 Answer 1

1

"cannot authenticate code 18" means your driver is incompatible with the version of your database running with mLab. If your driver is using MONGODB-CR and your database is running SCRAM-SHA-1 as the authentication mechanism, you'll get this error.

Confirm your driver is compatible with the version of your mLab database server.

https://docs.mongodb.com/ecosystem/drivers/driver-compatibility-reference/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.