Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCSP-18271: Add list users page #5884

Merged
merged 1 commit into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/core/security-users.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@ general, clients should connect to the sharded cluster through the

/tutorial/create-users
/tutorial/authenticate-a-user
/tutorial/list-users
42 changes: 42 additions & 0 deletions source/tutorial/list-users.txt
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`.