-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathdb.collection.dropSearchIndex.txt
104 lines (67 loc) · 2.25 KB
/
db.collection.dropSearchIndex.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
94
95
96
97
98
99
100
101
102
103
104
===============================
db.collection.dropSearchIndex()
===============================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol
Definition
----------
.. method:: db.collection.dropSearchIndex()
.. versionadded:: 7.0 (*Also available starting in 6.0.7*)
.. |fts-index| replace:: :atlas:`{+fts+} index </atlas-search/atlas-search-overview/#fts-indexes>`
.. include:: /includes/atlas-search-commands/command-descriptions/dropSearchIndex-description.rst
.. |dbcommand| replace:: :dbcommand:`dropSearchIndex` command
.. include:: /includes/fact-mongosh-shell-method-alt.rst
Compatibility
-------------
This method is available in deployments hosted in the following environments:
.. include:: /includes/fact-environments-atlas-only.rst
.. include:: /includes/fact-environments-atlas-support-no-free-or-serverless-search-index.rst
Syntax
------
Command syntax:
.. code-block:: javascript
db.<collection>.dropSearchIndex(<name>)
Command Fields
--------------
``dropSearchIndex()`` takes the following field:
.. list-table::
:header-rows: 1
:widths: 20 20 20 80
* - Field
- Type
- Necessity
- Description
* - ``name``
- string
- Required
- Name of the search index to drop.
Behavior
--------
.. |method-name| replace:: ``dropSearchIndex()``
.. |method-name-title| replace:: ``dropSearchIndex()``
.. include:: /includes/atlas-search-commands/behavior/delete-behavior.rst
Access Control
--------------
If your deployment enforces access control, the user running the
``dropSearchIndex()`` method must have the
:authaction:`dropSearchIndex` privilege action on the database:
.. code-block:: javascript
{ resource: { database : true }, actions: [ "dropSearchIndex" ] }
The built-in :authrole:`dbAdmin` and :authrole:`readWrite` roles provide
the ``dropSearchIndex`` privilege. The following example grants the
``readWrite`` role on the ``qa`` database:
.. code-block:: javascript
db.grantRolesToUser(
"<user>",
[ { role: "readWrite", db: "qa" } ]
)
Example
-------
The following example deletes a search index named ``searchIndex01`` on
the ``movies`` collection:
.. code-block:: javascript
db.movies.dropSearchIndex("searchIndex01")