Navigation
This version of the manual is no longer supported.

db.addUser()

db.addUser("username", "password"[, readOnly])
Parameters:
  • username (string) – Specifies a new username.
  • password (string) – Specifies the corresponding password.
  • readOnly (boolean) – Optional. Restrict a user to read-privileges only. Defaults to false.

Use this function to create new database users, by specifying a username and password as arguments to the command. If you want to restrict the user to have only read-only privileges, supply a true third argument; as in the following example:

db.addUser("user1" , "pass" , true )

By default the readOnly option, is false.