-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
487543f
commit b5dcaa5
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.. _list-users: | ||
|
||
========== | ||
List Users | ||
========== | ||
|
||
.. default-domain:: mongodb | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 3 | ||
:class: singlecol | ||
|
||
To list all users, use :binary:`~bin.mongosh` to query the | ||
:doc:`system.users </reference/system-users-collection>` collection: | ||
|
||
.. code-block:: sh | ||
|
||
use admin | ||
db.system.users.find() | ||
|
||
.. important:: | ||
|
||
Do not modify the :doc:`system.users | ||
</reference/system-users-collection>` collection directly. To manage | ||
users, use the designated :ref:`user management commands | ||
<user-management-commands>`. | ||
|
||
To list all users of a :doc:`sharded cluster </sharding>` that were | ||
created through a :binary:`~bin.mongos`, connect to a | ||
:binary:`~bin.mongos` and run the preceding command. MongoDB stores | ||
users that are created through a :binary:`~bin.mongos` in the ``admin`` | ||
database of the :term:`config servers <config server>`. | ||
|
||
To list all :ref:`shard local users | ||
<shard-local-users>`, connect to the respective shard directly and run | ||
the preceding command. MongoDB stores *shard local* users in the | ||
``admin`` database of the shard itself. These *shard local* users are | ||
independent from the users added to the sharded cluster through a | ||
:binary:`~bin.mongos`. *Shard local* users are local to the shard and | ||
are inaccessible to :binary:`~bin.mongos`. |