Answers for "how to assign database for every new user in mongodb"

6

mongodb add user

use <your database>
db.createUser({
  user: '<some username>',
  pwd: passwordPrompt(),
  roles: [{
    role: 'readWrite',
    db: '<your database>'
  }]
})
Posted by: Guest on July-17-2020
1

create admin user in mongodb

use admin
db.createUser(
      {
          user: "username",
          pwd: "password",
          roles: [ "root" ]
      }
  )
Posted by: Guest on April-19-2020

Code answers related to "how to assign database for every new user in mongodb"

Code answers related to "Javascript"

Browse Popular Code Answers by Language