db.addUser()

db.addUser("username", "password"[, readOnly])
参数:
  • 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; however, this defaults to false.

For example:

db.addUser("user1" , "pass" , { readOnly : true } )

MongoDB Manual (Index)

关于

生态系统

格式

资源