- Reference >
- Database Commands >
- User Management Commands >
- usersInfo
usersInfo¶
On this page
Definition¶
-
usersInfo¶ Returns information about one or more users. To match a single user on the database, use the following form:
The command has the following fields:
Field Type Description usersInfovarious The user(s) about whom to return information. See Behavior for type and syntax. showCredentialsboolean Optional. Set the field to true to display the user’s password hash. By default, this field is false.showPrivilegesboolean Optional. Set the field to true to show the user’s full set of privileges, including expanded information for the inherited roles. By default, this field is false. If viewing all users, you cannot specify this field.
Required Access¶
Users can always view their own information.
To view another user’s information, the user running the command must
have privileges that include the viewUser action on the
other user’s database.
Behavior¶
The argument to the usersInfo command has multiple forms
depending on the requested information:
Specify a Single User¶
In the usersInfo field, specify a document with the user’s name and
database:
Alternatively, for a user that exists on the same database where the command runs, you can specify the user by its name only.
Specify Multiple Users¶
In the usersInfo field, specify an array of documents:
Specify All Users for a Database¶
In the usersInfo field, specify 1:
Examples¶
View Specific Users¶
To see information and privileges, but not the credentials, for the
user "Kari" defined in "home" database,
run the following command:
To view a user that exists in the current database, you can specify
the user by name only. For example, if you are in the home
database and a user named "Kari" exists in the home database,
you can run the following command:
View Multiple Users¶
To view info for several users, use an array, with or without the
optional fields showPrivileges and showCredentials. For example:
View All Users for a Database¶
To view all users on the database the command is run, use a command document that resembles the following:
When viewing all users, you can specify the showCredentials
field but not the showPrivileges field.