- Security >
- Security Reference >
system.users
Collection
system.users
Collection¶
On this page
The system.users
collection in the admin
database stores user
authentication and authorization information. To manage data in this collection,
MongoDB provides user management commands.
system.users
Schema¶
The documents in the system.users
collection have the following
schema:
Each system.users
document has the following fields:
-
admin.system.users.
userId
¶ A unique identifier for the user assigned to the user upon creation.
userId
is available for userscreated
in MongoDB 4.0.9 and later.New in version 4.0.9.
-
admin.system.users.
user
¶ The user name. A user exists in the context of a single logical database (see
admin.system.users.db
) but can have access on other databases through roles specified in theroles
array.
-
admin.system.users.
db
¶ The authentication database associated with the user. The user’s privileges are not necessarily limited to this database. The user can have privileges in additional databases through the
roles
array.
-
admin.system.users.
credentials
¶ User’s authentication information. For users with externally stored authentication credentials, such as users that use Kerberos or x.509 certificates for authentication, the
system.users
document for that user does not contain thecredentials
field. For SCRAM user credentials, the information includes the mechanism, iteration count, and authentication parameters.
-
admin.system.users.
roles
¶ An array of roles granted to the user. The array contains both built-in roles and user-defined role.
A role document has the following syntax:
A role document has the following fields:
-
admin.system.users.roles[n].
role
¶ The name of a role. A role can be a built-in role provided by MongoDB or a custom user-defined role.
-
admin.system.users.roles[n].
db
¶ The name of the database where role is defined.
When specifying a role using the role management or user management commands, you can specify the role name alone (e.g.
"readWrite"
) if the role that exists on the database on which the command is run.-
-
admin.system.users.
customData
¶ Optional custom information about the user.
-
admin.system.users.
authenticationRestrictions
¶ An array of authentication restrictions the server enforces for the user. The array containsa list of IP addresses and CIDR ranges from which the user is allowed to connect to the server or from which the server can accept users.
New in version 4.0.