Skip to content

Commit 41df190

Browse files
committed
DOCS-11758: drop takes options document
1 parent bc5e9e1 commit 41df190

File tree

3 files changed

+77
-14
lines changed

3 files changed

+77
-14
lines changed

source/reference/command/drop.txt

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,37 @@ drop
1717

1818
.. code-block:: javascript
1919

20-
{ drop: <collection_name> }
20+
{ drop: <collection_name>, writeConcern: <document>}
21+
22+
The command takes the following fields:
23+
24+
.. list-table::
25+
:header-rows: 1
26+
:widths: 20 80
27+
28+
* - Field
29+
- Description
30+
31+
* - drop
32+
- The name of the collection to drop.
33+
34+
* - writeConcern
35+
36+
- Optional. A document expressing the :doc:`write concern
37+
</reference/write-concern>` of the :dbcommand:`drop` command.
38+
Omit to use the default write concern.
39+
2140

2241
The :binary:`~bin.mongo` shell provides the equivalent helper method
2342
:method:`db.collection.drop()`.
2443

25-
This command also removes any indexes associated with the dropped
26-
collection.
44+
Behavior
45+
--------
46+
47+
This command also removes any indexes associated with the dropped
48+
collection.
2749

28-
.. warning::
50+
.. warning::
2951

30-
This command obtains a write lock on the affected database and
31-
will block other operations until it has completed.
52+
This command obtains a write lock on the affected database and
53+
will block other operations until it has completed.

source/reference/method/db.collection.drop.txt

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ db.collection.drop()
1515
Definition
1616
----------
1717

18-
.. method:: db.collection.drop()
18+
.. method:: db.collection.drop(<options>)
1919

2020
Removes a collection or :doc:`view </core/views>` from the database.
2121
The method also removes any indexes associated with the dropped
@@ -24,13 +24,33 @@ Definition
2424

2525
:method:`db.collection.drop()` has the form:
2626

27+
.. versionchanged:: 4.0
28+
29+
:method:`db.collection.drop()` accepts an options document.
30+
2731
.. code-block:: javascript
2832

29-
db.collection.drop()
33+
db.collection.drop( { writeConcern: <document> } )
34+
35+
:method:`db.collection.drop()` takes an optional document with the
36+
following field:
37+
38+
.. list-table::
39+
:header-rows: 1
40+
:widths: 20 80
3041

31-
:method:`db.collection.drop()` takes no arguments and will produce
32-
an error if called with any arguments.
42+
* - Field
43+
- Description
3344

45+
* - writeConcern
46+
47+
- Optional. A document expressing the :doc:`write concern
48+
</reference/write-concern>` of the
49+
:method:`db.collection.drop()` operation. Omit to use the
50+
default write concern.
51+
52+
.. versionadded:: 4.0
53+
3454
:returns:
3555
- ``true`` when successfully drops a collection.
3656
- ``false`` when collection to drop does not exist.
@@ -44,9 +64,27 @@ will block other operations until it has completed.
4464
Example
4565
-------
4666

67+
Drop a Collection Using Default Write Concern
68+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69+
4770
The following operation drops the ``students`` collection in the
4871
current database.
4972

5073
.. code-block:: javascript
5174

5275
db.students.drop()
76+
77+
Drop a Collection Using ``w: "majority"`` Write Concern
78+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79+
80+
.. versionchanged:: 4.0
81+
82+
:method:`db.collection.drop()` accepts an options document.
83+
84+
The following operation drops the ``students`` collection in the
85+
current database. The operation uses the :writeconcern:`"majority"`
86+
write concern:
87+
88+
.. code-block:: javascript
89+
90+
db.students.drop( { writeConcern: "majority" } )

source/release-notes/4.0.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,19 +475,22 @@ Aggregation
475475
Commands
476476
~~~~~~~~
477477

478-
- Added the following option to :dbcommand:`listCollections` command
479-
and the :binary:`~bin.mongo` shell helper
480-
:method:`db.getCollectionInfos()`:
478+
- The command :dbcommand:`listCollections` and its :binary:`~bin.mongo`
479+
shell helper :method:`db.getCollectionInfos()` accepts the following
480+
option:
481481

482482
- ``nameOnly`` to return only the collection names and types (which
483483
does not require collection locks).
484484

485-
- The command :dbcommand:`serverStatus` and the :binary:`~bin.mongo`
485+
- The command :dbcommand:`serverStatus` and its :binary:`~bin.mongo`
486486
shell helper :method:`db.serverStatus()` includes
487487
:serverstatus:`shardingStatistics` in its output. The
488488
:serverstatus:`shardingStatistics` includes data on metadata refresh
489489
on sharded clusters.
490490

491+
- The :binary:`~bin.mongo` shell helper :method:`db.collection.drop()`
492+
accepts the write concern option.
493+
491494
Network Layer Improvements
492495
~~~~~~~~~~~~~~~~~~~~~~~~~~
493496

0 commit comments

Comments
 (0)