-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
dropAllUsersFromDatabase.txt
91 lines (53 loc) · 1.83 KB
/
dropAllUsersFromDatabase.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
========================
dropAllUsersFromDatabase
========================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. dbcommand:: dropAllUsersFromDatabase
Removes all users from the database on which you run the
command.
.. warning::
The :dbcommand:`dropAllUsersFromDatabase` removes all users from the database.
The :dbcommand:`dropAllUsersFromDatabase` command has the following
syntax:
.. code-block:: javascript
{ dropAllUsersFromDatabase: 1,
writeConcern: { <write concern> }
}
The :dbcommand:`dropAllUsersFromDatabase` document has the following
fields:
.. list-table::
:header-rows: 1
:widths: 20 20 80
* - Field
- Type
- Description
* - ``dropAllUsersFromDatabase``
- integer
- Specify ``1`` to drop all the users from the current database.
* - ``writeConcern``
- document
- Optional. The level of :doc:`write concern </reference/write-concern>` for the
removal operation. The ``writeConcern`` document takes the same
fields as the :dbcommand:`getLastError` command.
Required Access
---------------
.. |local-cmd-name| replace:: :command:`dropAllUsersFromDatabase`
.. include:: /includes/access-drop-user.rst
Example
-------
The following sequence of operations in the :binary:`~bin.mongo` shell drops
every user from the ``products`` database:
.. code-block:: javascript
use products
db.runCommand( { dropAllUsersFromDatabase: 1, writeConcern: { w: "majority" } } )
The ``n`` field in the results document shows the number of users
removed:
.. code-block:: javascript
{ "n" : 12, "ok" : 1 }