/
dropRole.txt
93 lines (58 loc) · 1.69 KB
/
dropRole.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
92
93
========
dropRole
========
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. dbcommand:: dropRole
Deletes a :ref:`user-defined <user-defined-roles>` role from the
database on which you run the command.
.. |method| replace:: :method:`db.dropRole` helper method
.. include:: /includes/fact-dbcommand-tip.rst
The :dbcommand:`dropRole` command uses the following syntax:
.. code-block:: javascript
{
dropRole: "<role>",
writeConcern: { <write concern> }
}
The :dbcommand:`dropRole` command has the following fields:
.. list-table::
:header-rows: 1
:widths: 20 20 80
* - Field
- Type
- Description
* - ``dropRole``
- string
- The name of the :ref:`user-defined role <user-defined-roles>` to remove
from the 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.
Behavior
--------
Authentication
~~~~~~~~~~~~~~
.. include:: /includes/behavior-drop-role.rst
Required Access
---------------
.. include:: /includes/access-drop-role.rst
Example
-------
The following operations remove the ``readPrices`` role from the
``products`` database:
.. code-block:: javascript
use products
db.runCommand(
{
dropRole: "readPrices",
writeConcern: { w: "majority" }
}
)