Skip to content

adds dropUser() method #1414

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

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 8 additions & 0 deletions bin/builddata/htaccess-next.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,14 @@ redirect-path: '/reference/method/js-user-management'
url-base: '/reference/security'
type: 'redirect'
code: 303
outputs:
- 'manual'
- 'before-v2.4'
---
redirect-path: '/reference/method/db.dropUser'
url-base: '/reference/security'
type: 'redirect'
code: 303
outputs:
- 'manual'
- 'before-v2.4'
Expand Down
2 changes: 2 additions & 0 deletions source/includes/access-drop-user.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
To issue the :dbcommand:`dropUser` command, a user must have access that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

erhm, we should make this be |local-cmd-name|

includes the :authaction:`dropUser` action for that database.
10 changes: 5 additions & 5 deletions source/includes/ref-toc-method-user-management.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ description: |
# description: |
# Updates user data.
# ---
# name: :method:`db.dropUser()`
# file: /reference/method/db.dropUser
# description: |
# Removes a single user.
# ---
name: :method:`db.dropUser()`
file: /reference/method/db.dropUser
description: |
Removes a single user.
---
# name: :method:`db.dropAllUsers()`
# file: /reference/method/db.dropAllUsers
# description: |
Expand Down
1 change: 1 addition & 0 deletions source/reference/command/dropUser-field.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#Data from this file is included in reference/method/db.dropUser-param.yaml
object:
name: dropUser
type: dbcommand
Expand Down
12 changes: 6 additions & 6 deletions source/reference/command/dropUser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ Definition
Required Access
---------------

To issue the :dbcommand:`dropUser` command, a user must have access that
includes the :authaction:`dropUser` action for that database.
.. include:: /includes/access-drop-user.rst

Example
-------

The following sequence of operations in the :program:`mongo` shell removes
``Carlos`` from the ``products`` database:
``accountAdmin01`` from the ``products`` database:

.. code-block:: javascript

db.getSiblingDB("products").runCommand( { dropUser: "Carlos",
writeConcern: { w: "majority", wtimeout: 5000 }
} )
use products
db.runCommand( { dropUser: "accountAdmin01",
writeConcern: { w: "majority", wtimeout: 5000 }
} )
16 changes: 16 additions & 0 deletions source/reference/method/db.dropUser-param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
object:
name: db.dropUser()
type: method
field:
optional: false
type: param
name: username
type: string
position: 1
description: |
The name of the user to remove from the database.
---
file: /reference/command/dropUser-field.yaml
name: writeConcern
position: 2
...
38 changes: 38 additions & 0 deletions source/reference/method/db.dropUser.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
=============
db.dropUser()
=============

.. default-domain:: mongodb

Definition
----------

.. method:: db.dropUser ( username, writeConcern )

Removes the user from the database on which you run the
:method:`db.dropUser()` method.

The :method:`dropUser` method takes the following arguments:

.. include:: /reference/method/db.dropUser-param.rst

The :method:`db.dropUser()` method wraps the :dbcommand:`dropUser`
command.

.. |local-cmd-name| replace:: :method:`db.dropUser()`

Required Access
---------------

.. include:: /includes/access-drop-user.rst

Example
-------

The following :method:`db.dropUser()` operation drops the ``accountAdmin01``
user on the ``products`` database.

.. code-block:: javascript

use products
db.dropUser("accountAdmin01", {w: "majority", wtimeout: 5000})