-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy pathCollection.html
302 lines (295 loc) · 240 KB
/
Collection.html
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Collection | mongodb</title><meta name="description" content="Documentation for mongodb"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">mongodb</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">mongodb</a></li><li><a href="Collection.html">Collection</a></li></ul><h1>Class Collection<TSchema></h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>The <strong>Collection</strong> class is an internal class that embodies a MongoDB collection
allowing for insert/find/update/delete and other command operation on that MongoDB collection.</p>
<p><strong>COLLECTION Cannot directly be instantiated</strong></p>
</div><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Example" class="tsd-anchor"></a>Example<a href="#Example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-7">import</span><span class="hl-1"> { </span><span class="hl-6">MongoClient</span><span class="hl-1"> } </span><span class="hl-7">from</span><span class="hl-1"> </span><span class="hl-3">'mongodb'</span><span class="hl-1">;</span><br/><br/><span class="hl-2">interface</span><span class="hl-1"> </span><span class="hl-9">Pet</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">name</span><span class="hl-1">: </span><span class="hl-9">string</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-6">kind</span><span class="hl-1">: </span><span class="hl-3">'dog'</span><span class="hl-1"> | </span><span class="hl-3">'cat'</span><span class="hl-1"> | </span><span class="hl-3">'fish'</span><span class="hl-1">;</span><br/><span class="hl-1">}</span><br/><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-4">client</span><span class="hl-1"> = </span><span class="hl-2">new</span><span class="hl-1"> </span><span class="hl-0">MongoClient</span><span class="hl-1">(</span><span class="hl-3">'mongodb://localhost:27017'</span><span class="hl-1">);</span><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-4">pets</span><span class="hl-1"> = </span><span class="hl-6">client</span><span class="hl-1">.</span><span class="hl-0">db</span><span class="hl-1">().</span><span class="hl-0">collection</span><span class="hl-1"><</span><span class="hl-9">Pet</span><span class="hl-1">>(</span><span class="hl-3">'pets'</span><span class="hl-1">);</span><br/><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-4">petCursor</span><span class="hl-1"> = </span><span class="hl-6">pets</span><span class="hl-1">.</span><span class="hl-0">find</span><span class="hl-1">();</span><br/><br/><span class="hl-7">for</span><span class="hl-1"> </span><span class="hl-7">await</span><span class="hl-1"> (</span><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-4">pet</span><span class="hl-1"> </span><span class="hl-2">of</span><span class="hl-1"> </span><span class="hl-6">petCursor</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-6">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">`</span><span class="hl-2">${</span><span class="hl-6">pet</span><span class="hl-12">.</span><span class="hl-6">name</span><span class="hl-2">}</span><span class="hl-3"> is a </span><span class="hl-2">${</span><span class="hl-6">pet</span><span class="hl-12">.</span><span class="hl-6">kind</span><span class="hl-2">}</span><span class="hl-3">!`</span><span class="hl-1">);</span><br/><span class="hl-1">}</span>
</code><button type="button">Copy</button></pre>
</div></section> <section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="TSchema" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">TSchema</span><span class="tsd-signature-keyword"> extends </span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a> = <a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a></span></li></ul></section> <aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L165">src/collection.ts:165</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Accessors</h3><div class="tsd-index-list"><a href="Collection.html#bsonOptions" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>bson<wbr/>Options</span></a>
<a href="Collection.html#collectionName" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>collection<wbr/>Name</span></a>
<a href="Collection.html#dbName" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>db<wbr/>Name</span></a>
<a href="Collection.html#hint" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>hint</span></a>
<a href="Collection.html#namespace" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>namespace</span></a>
<a href="Collection.html#readConcern" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>read<wbr/>Concern</span></a>
<a href="Collection.html#readPreference" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>read<wbr/>Preference</span></a>
<a href="Collection.html#timeoutMS" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>timeoutMS</span></a>
<a href="Collection.html#writeConcern" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>write<wbr/>Concern</span></a>
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="Collection.html#aggregate" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>aggregate</span></a>
<a href="Collection.html#bulkWrite" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>bulk<wbr/>Write</span></a>
<a href="Collection.html#count" class="tsd-index-link deprecated"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>count</span></a>
<a href="Collection.html#countDocuments" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>count<wbr/>Documents</span></a>
<a href="Collection.html#createIndex" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Index</span></a>
<a href="Collection.html#createIndexes" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Indexes</span></a>
<a href="Collection.html#createSearchIndex" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Search<wbr/>Index</span></a>
<a href="Collection.html#createSearchIndexes" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Search<wbr/>Indexes</span></a>
<a href="Collection.html#deleteMany" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>delete<wbr/>Many</span></a>
<a href="Collection.html#deleteOne" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>delete<wbr/>One</span></a>
<a href="Collection.html#distinct" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>distinct</span></a>
<a href="Collection.html#drop" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop</span></a>
<a href="Collection.html#dropIndex" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop<wbr/>Index</span></a>
<a href="Collection.html#dropIndexes" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop<wbr/>Indexes</span></a>
<a href="Collection.html#dropSearchIndex" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop<wbr/>Search<wbr/>Index</span></a>
<a href="Collection.html#estimatedDocumentCount" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>estimated<wbr/>Document<wbr/>Count</span></a>
<a href="Collection.html#find" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find</span></a>
<a href="Collection.html#findOne" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find<wbr/>One</span></a>
<a href="Collection.html#findOneAndDelete" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find<wbr/>One<wbr/>And<wbr/>Delete</span></a>
<a href="Collection.html#findOneAndReplace" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find<wbr/>One<wbr/>And<wbr/>Replace</span></a>
<a href="Collection.html#findOneAndUpdate" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find<wbr/>One<wbr/>And<wbr/>Update</span></a>
<a href="Collection.html#indexes" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>indexes</span></a>
<a href="Collection.html#indexExists" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>index<wbr/>Exists</span></a>
<a href="Collection.html#indexInformation" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>index<wbr/>Information</span></a>
<a href="Collection.html#initializeOrderedBulkOp" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>initialize<wbr/>Ordered<wbr/>Bulk<wbr/>Op</span></a>
<a href="Collection.html#initializeUnorderedBulkOp" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>initialize<wbr/>Unordered<wbr/>Bulk<wbr/>Op</span></a>
<a href="Collection.html#insertMany" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>insert<wbr/>Many</span></a>
<a href="Collection.html#insertOne" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>insert<wbr/>One</span></a>
<a href="Collection.html#isCapped" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Capped</span></a>
<a href="Collection.html#listIndexes" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>list<wbr/>Indexes</span></a>
<a href="Collection.html#listSearchIndexes" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>list<wbr/>Search<wbr/>Indexes</span></a>
<a href="Collection.html#options" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>options</span></a>
<a href="Collection.html#rename" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>rename</span></a>
<a href="Collection.html#replaceOne" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>replace<wbr/>One</span></a>
<a href="Collection.html#updateMany" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>Many</span></a>
<a href="Collection.html#updateOne" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>One</span></a>
<a href="Collection.html#updateSearchIndex" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>Search<wbr/>Index</span></a>
<a href="Collection.html#watch" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>watch</span></a>
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Accessors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Accessors</h2></summary><section><section class="tsd-panel tsd-member"><a id="bsonOptions" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>bson<wbr/>Options</span><a href="#bsonOptions" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="bsonOptions.bsonOptions-1"><span class="tsd-signature-keyword">get</span> bsonOptions<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/BSONSerializeOptions.html" class="tsd-signature-type tsd-kind-interface">BSONSerializeOptions</a></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="../interfaces/BSONSerializeOptions.html" class="tsd-signature-type tsd-kind-interface">BSONSerializeOptions</a></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L245">src/collection.ts:245</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="collectionName" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>collection<wbr/>Name</span><a href="#collectionName" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="collectionName.collectionName-1"><span class="tsd-signature-keyword">get</span> collectionName<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The name of this collection</p>
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L202">src/collection.ts:202</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="dbName" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>db<wbr/>Name</span><a href="#dbName" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="dbName.dbName-1"><span class="tsd-signature-keyword">get</span> dbName<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The name of the database this collection belongs to</p>
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L195">src/collection.ts:195</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="hint" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>hint</span><a href="#hint" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="hint.hint-1"><span class="tsd-signature-keyword">get</span> hint<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../types/Hint.html" class="tsd-signature-type tsd-kind-type-alias">Hint</a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The current index hint for the collection</p>
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../types/Hint.html" class="tsd-signature-type tsd-kind-type-alias">Hint</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L261">src/collection.ts:261</a></li></ul></aside></li><li class="tsd-signature" id="hint.hint-2"><span class="tsd-signature-keyword">set</span> hint<span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">v</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">v</span>: <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../types/Hint.html" class="tsd-signature-type tsd-kind-type-alias">Hint</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L265">src/collection.ts:265</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="namespace" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>namespace</span><a href="#namespace" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="namespace.namespace-1"><span class="tsd-signature-keyword">get</span> namespace<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The namespace of this collection, in the format <code>${this.dbName}.${this.collectionName}</code></p>
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L209">src/collection.ts:209</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="readConcern" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Concern</span><a href="#readConcern" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="readConcern.readConcern-1"><span class="tsd-signature-keyword">get</span> readConcern<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="ReadConcern.html" class="tsd-signature-type tsd-kind-class">ReadConcern</a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The current readConcern of the collection. If not explicitly defined for
this collection, will be inherited from the parent DB</p>
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="ReadConcern.html" class="tsd-signature-type tsd-kind-class">ReadConcern</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L226">src/collection.ts:226</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="readPreference" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Preference</span><a href="#readPreference" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="readPreference.readPreference-1"><span class="tsd-signature-keyword">get</span> readPreference<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="ReadPreference.html" class="tsd-signature-type tsd-kind-class">ReadPreference</a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The current readPreference of the collection. If not explicitly defined for
this collection, will be inherited from the parent DB</p>
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="ReadPreference.html" class="tsd-signature-type tsd-kind-class">ReadPreference</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L237">src/collection.ts:237</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="timeoutMS" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>timeoutMS</span><a href="#timeoutMS" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="timeoutMS.timeoutMS-1"><span class="tsd-signature-keyword">get</span> timeoutMS<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L269">src/collection.ts:269</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="writeConcern" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Concern</span><a href="#writeConcern" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="writeConcern.writeConcern-1"><span class="tsd-signature-keyword">get</span> writeConcern<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="WriteConcern.html" class="tsd-signature-type tsd-kind-class">WriteConcern</a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The current writeConcern of the collection. If not explicitly defined for
this collection, will be inherited from the parent DB</p>
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="WriteConcern.html" class="tsd-signature-type tsd-kind-class">WriteConcern</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L253">src/collection.ts:253</a></li></ul></aside></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="aggregate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>aggregate</span><a href="#aggregate" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="aggregate.aggregate-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">aggregate</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#aggregate.aggregate-1.T">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">pipeline</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="AggregationCursor.html" class="tsd-signature-type tsd-kind-class">AggregationCursor</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#aggregate.aggregate-1.T">T</a><span class="tsd-signature-symbol">></span><a href="#aggregate.aggregate-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2</p>
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="aggregate.aggregate-1.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a> = <a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">pipeline</span>: <a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> = []</span></span><div class="tsd-comment tsd-typography"><p>An array of aggregation pipelines to execute</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/AggregateOptions.html" class="tsd-signature-type tsd-kind-interface">AggregateOptions</a><span class="tsd-signature-symbol"> & </span><a href="../types/Abortable.html" class="tsd-signature-type tsd-kind-type-alias">Abortable</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="AggregationCursor.html" class="tsd-signature-type tsd-kind-class">AggregationCursor</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#aggregate.aggregate-1.T">T</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L1022">src/collection.ts:1022</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="bulkWrite" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>bulk<wbr/>Write</span><a href="#bulkWrite" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="bulkWrite.bulkWrite-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">bulk<wbr/>Write</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">operations</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="BulkWriteResult.html" class="tsd-signature-type tsd-kind-class">BulkWriteResult</a><span class="tsd-signature-symbol">></span><a href="#bulkWrite.bulkWrite-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Perform a bulkWrite operation without a fluent API</p>
<p>Legal operation types are</p>
<ul>
<li><code>insertOne</code></li>
<li><code>replaceOne</code></li>
<li><code>updateOne</code></li>
<li><code>updateMany</code></li>
<li><code>deleteOne</code></li>
<li><code>deleteMany</code></li>
</ul>
<p>If documents passed in do not contain the <strong>_id</strong> field,
one will be added to each of the documents missing it by the driver, mutating the document. This behavior
can be overridden by setting the <strong>forceServerObjectId</strong> flag.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">operations</span>: <span class="tsd-signature-keyword">readonly </span><a href="../types/AnyBulkWriteOperation.html" class="tsd-signature-type tsd-kind-type-alias">AnyBulkWriteOperation</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>Bulk operations to perform</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/BulkWriteOptions.html" class="tsd-signature-type tsd-kind-interface">BulkWriteOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="BulkWriteResult.html" class="tsd-signature-type tsd-kind-class">BulkWriteResult</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Throws" class="tsd-anchor"></a>Throws<a href="#Throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>MongoDriverError if operations is not an array</p>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L336">src/collection.ts:336</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="count" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="deprecated">count</span><a href="#count" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="count.count-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">count</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">></span><a href="#count.count-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>An estimated count of matching documents in the db to a filter.</p>
<p><strong>NOTE:</strong> This method has been deprecated, since it does not provide an accurate count of the documents
in a collection. To obtain an accurate count of documents in the collection, use Collection#countDocuments| countDocuments.
To obtain an estimated count of all documents in the collection, use Collection#estimatedDocumentCount| estimatedDocumentCount.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>The filter for the count.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/CountOptions.html" class="tsd-signature-type tsd-kind-interface">CountOptions</a><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Deprecated" class="tsd-anchor"></a>Deprecated<a href="#Deprecated" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>use Collection#countDocuments| countDocuments or Collection#estimatedDocumentCount| estimatedDocumentCount instead</p>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L1180">src/collection.ts:1180</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="countDocuments" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>count<wbr/>Documents</span><a href="#countDocuments" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="countDocuments.countDocuments-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">count<wbr/>Documents</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">></span><a href="#countDocuments.countDocuments-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets the number of documents matching the filter.
For a fast count of the total documents in a collection see Collection#estimatedDocumentCount| estimatedDocumentCount.</p>
<p>Due to countDocuments using the $match aggregation pipeline stage, certain query operators cannot be used in countDocuments. This includes the $where and $near query operators, among others. Details can be found in the documentation for the $match aggregation pipeline stage.</p>
<p><strong>Note</strong>: When migrating from Collection#count| count to Collection#countDocuments| countDocuments
the following query operators must be replaced:</p>
<table>
<thead>
<tr>
<th>Operator</th>
<th>Replacement</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>$where</code></td>
<td><a href="https://www.mongodb.com/docs/manual/reference/operator/query/expr/" target="_blank" class="external"><code>$expr</code></a></td>
</tr>
<tr>
<td><code>$near</code></td>
<td><a href="https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/" target="_blank" class="external"><code>$geoWithin</code></a> with <a href="https://www.mongodb.com/docs/manual/reference/operator/query/center/#op._S_center" target="_blank" class="external"><code>$center</code></a></td>
</tr>
<tr>
<td><code>$nearSphere</code></td>
<td><a href="https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/" target="_blank" class="external"><code>$geoWithin</code></a> with <a href="https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/#op._S_centerSphere" target="_blank" class="external"><code>$centerSphere</code></a></td>
</tr>
</tbody>
</table>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>The filter for the count</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/CountDocumentsOptions.html" class="tsd-signature-type tsd-kind-interface">CountDocumentsOptions</a><span class="tsd-signature-symbol"> & </span><a href="../types/Abortable.html" class="tsd-signature-type tsd-kind-type-alias">Abortable</a><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="See" class="tsd-anchor"></a>See<a href="#See" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><ul>
<li><a href="https://www.mongodb.com/docs/manual/reference/operator/query/expr/" target="_blank" class="external">https://www.mongodb.com/docs/manual/reference/operator/query/expr/</a></li>
<li><a href="https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/" target="_blank" class="external">https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/</a></li>
<li><a href="https://www.mongodb.com/docs/manual/reference/operator/query/center/#op._S_center" target="_blank" class="external">https://www.mongodb.com/docs/manual/reference/operator/query/center/#op._S_center</a></li>
<li><a href="https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/#op._S_centerSphere" target="_blank" class="external">https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/#op._S_centerSphere</a></li>
</ul>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L800">src/collection.ts:800</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="createIndex" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>create<wbr/>Index</span><a href="#createIndex" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="createIndex.createIndex-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">create<wbr/>Index</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">indexSpec</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span><a href="#createIndex.createIndex-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates an index on the db and collection collection.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">indexSpec</span>: <a href="../types/IndexSpecification.html" class="tsd-signature-type tsd-kind-type-alias">IndexSpecification</a></span><div class="tsd-comment tsd-typography"><p>The field name or index specification to create an index for</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/CreateIndexesOptions.html" class="tsd-signature-type tsd-kind-interface">CreateIndexesOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Example-1" class="tsd-anchor"></a>Example<a href="#Example-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-4">collection</span><span class="hl-1"> = </span><span class="hl-6">client</span><span class="hl-1">.</span><span class="hl-0">db</span><span class="hl-1">(</span><span class="hl-3">'foo'</span><span class="hl-1">).</span><span class="hl-0">collection</span><span class="hl-1">(</span><span class="hl-3">'bar'</span><span class="hl-1">);</span><br/><br/><span class="hl-7">await</span><span class="hl-1"> </span><span class="hl-6">collection</span><span class="hl-1">.</span><span class="hl-0">createIndex</span><span class="hl-1">({ </span><span class="hl-6">a:</span><span class="hl-1"> </span><span class="hl-8">1</span><span class="hl-1">, </span><span class="hl-6">b:</span><span class="hl-1"> -</span><span class="hl-8">1</span><span class="hl-1"> });</span><br/><br/><span class="hl-5">// Alternate syntax for { c: 1, d: -1 } that ensures order of indexes</span><br/><span class="hl-7">await</span><span class="hl-1"> </span><span class="hl-6">collection</span><span class="hl-1">.</span><span class="hl-0">createIndex</span><span class="hl-1">([ [</span><span class="hl-6">c</span><span class="hl-1">, </span><span class="hl-8">1</span><span class="hl-1">], [</span><span class="hl-6">d</span><span class="hl-1">, -</span><span class="hl-8">1</span><span class="hl-1">] ]);</span><br/><br/><span class="hl-5">// Equivalent to { e: 1 }</span><br/><span class="hl-7">await</span><span class="hl-1"> </span><span class="hl-6">collection</span><span class="hl-1">.</span><span class="hl-0">createIndex</span><span class="hl-1">(</span><span class="hl-3">'e'</span><span class="hl-1">);</span><br/><br/><span class="hl-5">// Equivalent to { f: 1, g: 1 }</span><br/><span class="hl-7">await</span><span class="hl-1"> </span><span class="hl-6">collection</span><span class="hl-1">.</span><span class="hl-0">createIndex</span><span class="hl-1">([</span><span class="hl-3">'f'</span><span class="hl-1">, </span><span class="hl-3">'g'</span><span class="hl-1">])</span><br/><br/><span class="hl-5">// Equivalent to { h: 1, i: -1 }</span><br/><span class="hl-7">await</span><span class="hl-1"> </span><span class="hl-6">collection</span><span class="hl-1">.</span><span class="hl-0">createIndex</span><span class="hl-1">([ { </span><span class="hl-6">h:</span><span class="hl-1"> </span><span class="hl-8">1</span><span class="hl-1"> }, { </span><span class="hl-6">i:</span><span class="hl-1"> -</span><span class="hl-8">1</span><span class="hl-1"> } ]);</span><br/><br/><span class="hl-5">// Equivalent to { j: 1, k: -1, l: 2d }</span><br/><span class="hl-7">await</span><span class="hl-1"> </span><span class="hl-6">collection</span><span class="hl-1">.</span><span class="hl-0">createIndex</span><span class="hl-1">([</span><span class="hl-3">'j'</span><span class="hl-1">, [</span><span class="hl-3">'k'</span><span class="hl-1">, -</span><span class="hl-8">1</span><span class="hl-1">], { </span><span class="hl-6">l:</span><span class="hl-1"> </span><span class="hl-3">'2d'</span><span class="hl-1"> }])</span>
</code><button type="button">Copy</button></pre>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L605">src/collection.ts:605</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="createIndexes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>create<wbr/>Indexes</span><a href="#createIndexes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="createIndexes.createIndexes-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">create<wbr/>Indexes</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">indexSpecs</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#createIndexes.createIndexes-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates multiple indexes in the collection, this method is only supported for
MongoDB 2.6 or higher. Earlier version of MongoDB will throw a command not supported
error.</p>
<p><strong>Note</strong>: Unlike Collection#createIndex| createIndex, this function takes in raw index specifications.
Index specifications are defined <a href="https://www.mongodb.com/docs/manual/reference/command/createIndexes/|">here</a>.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">indexSpecs</span>: <a href="../interfaces/IndexDescription.html" class="tsd-signature-type tsd-kind-interface">IndexDescription</a><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>An array of index specifications to be created</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/CreateIndexesOptions.html" class="tsd-signature-type tsd-kind-interface">CreateIndexesOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Example-2" class="tsd-anchor"></a>Example<a href="#Example-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-4">collection</span><span class="hl-1"> = </span><span class="hl-6">client</span><span class="hl-1">.</span><span class="hl-0">db</span><span class="hl-1">(</span><span class="hl-3">'foo'</span><span class="hl-1">).</span><span class="hl-0">collection</span><span class="hl-1">(</span><span class="hl-3">'bar'</span><span class="hl-1">);</span><br/><span class="hl-7">await</span><span class="hl-1"> </span><span class="hl-6">collection</span><span class="hl-1">.</span><span class="hl-0">createIndexes</span><span class="hl-1">([</span><br/><span class="hl-1"> </span><span class="hl-5">// Simple index on field fizz</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">key:</span><span class="hl-1"> { </span><span class="hl-6">fizz:</span><span class="hl-1"> </span><span class="hl-8">1</span><span class="hl-1"> },</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">// wildcard index</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">key:</span><span class="hl-1"> { </span><span class="hl-3">'$**'</span><span class="hl-6">:</span><span class="hl-1"> </span><span class="hl-8">1</span><span class="hl-1"> }</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-5">// named index on darmok and jalad</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">key:</span><span class="hl-1"> { </span><span class="hl-6">darmok:</span><span class="hl-1"> </span><span class="hl-8">1</span><span class="hl-1">, </span><span class="hl-6">jalad:</span><span class="hl-1"> -</span><span class="hl-8">1</span><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-6">name</span><span class="hl-1">: </span><span class="hl-3">'tanagra'</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">]);</span>
</code><button type="button">Copy</button></pre>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L653">src/collection.ts:653</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="createSearchIndex" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>create<wbr/>Search<wbr/>Index</span><a href="#createSearchIndex" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="createSearchIndex.createSearchIndex-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">create<wbr/>Search<wbr/>Index</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">description</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span><a href="#createSearchIndex.createSearchIndex-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a single search index for the collection.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">description</span>: <a href="../interfaces/SearchIndexDescription.html" class="tsd-signature-type tsd-kind-interface">SearchIndexDescription</a></span><div class="tsd-comment tsd-typography"><p>The index description for the new search index.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4><p>A promise that resolves to the name of the new search index.</p>
<div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Remarks" class="tsd-anchor"></a>Remarks<a href="#Remarks" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Only available when used against a 7.0+ Atlas cluster.</p>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L1229">src/collection.ts:1229</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="createSearchIndexes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>create<wbr/>Search<wbr/>Indexes</span><a href="#createSearchIndexes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="createSearchIndexes.createSearchIndexes-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">create<wbr/>Search<wbr/>Indexes</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">descriptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#createSearchIndexes.createSearchIndexes-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates multiple search indexes for the current collection.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">descriptions</span>: <a href="../interfaces/SearchIndexDescription.html" class="tsd-signature-type tsd-kind-interface">SearchIndexDescription</a><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>An array of <code>SearchIndexDescription</code>s for the new search indexes.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>A promise that resolves to an array of the newly created search index names.</p>
<div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Remarks-1" class="tsd-anchor"></a>Remarks<a href="#Remarks-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Only available when used against a 7.0+ Atlas cluster.</p>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L1243">src/collection.ts:1243</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="deleteMany" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>delete<wbr/>Many</span><a href="#deleteMany" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="deleteMany.deleteMany-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">delete<wbr/>Many</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/DeleteResult.html" class="tsd-signature-type tsd-kind-interface">DeleteResult</a><span class="tsd-signature-symbol">></span><a href="#deleteMany.deleteMany-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Delete multiple documents from a collection</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>The filter used to select the documents to remove</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/DeleteOptions.html" class="tsd-signature-type tsd-kind-interface">DeleteOptions</a><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/DeleteResult.html" class="tsd-signature-type tsd-kind-interface">DeleteResult</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L453">src/collection.ts:453</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="deleteOne" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>delete<wbr/>One</span><a href="#deleteOne" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="deleteOne.deleteOne-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">delete<wbr/>One</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/DeleteResult.html" class="tsd-signature-type tsd-kind-interface">DeleteResult</a><span class="tsd-signature-symbol">></span><a href="#deleteOne.deleteOne-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Delete a document from a collection</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>The filter used to select the document to remove</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/DeleteOptions.html" class="tsd-signature-type tsd-kind-interface">DeleteOptions</a><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/DeleteResult.html" class="tsd-signature-type tsd-kind-interface">DeleteResult</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L437">src/collection.ts:437</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="distinct" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>distinct</span><a href="#distinct" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="distinct.distinct-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">distinct</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#distinct.distinct-1.Key">Key</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/Flatten.html" class="tsd-signature-type tsd-kind-type-alias">Flatten</a><span class="tsd-signature-symbol"><</span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#distinct.distinct-1.Key">Key</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#distinct.distinct-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>The distinct command returns a list of distinct values for the given key across a collection.</p>
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="distinct.distinct-1.Key" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Key</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#distinct.distinct-1.Key">Key</a></span><div class="tsd-comment tsd-typography"><p>Field of the document to find distinct values for</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/Flatten.html" class="tsd-signature-type tsd-kind-type-alias">Flatten</a><span class="tsd-signature-symbol"><</span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#distinct.distinct-1.Key">Key</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L830">src/collection.ts:830</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="distinct.distinct-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">distinct</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#distinct.distinct-2.Key-1">Key</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">filter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/Flatten.html" class="tsd-signature-type tsd-kind-type-alias">Flatten</a><span class="tsd-signature-symbol"><</span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#distinct.distinct-2.Key-1">Key</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#distinct.distinct-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="distinct.distinct-2.Key-1" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Key</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#distinct.distinct-2.Key-1">Key</a></span></li><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/Flatten.html" class="tsd-signature-type tsd-kind-type-alias">Flatten</a><span class="tsd-signature-symbol"><</span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#distinct.distinct-2.Key-1">Key</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L833">src/collection.ts:833</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="distinct.distinct-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">distinct</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#distinct.distinct-3.Key-2">Key</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/Flatten.html" class="tsd-signature-type tsd-kind-type-alias">Flatten</a><span class="tsd-signature-symbol"><</span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#distinct.distinct-3.Key-2">Key</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#distinct.distinct-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="distinct.distinct-3.Key-2" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Key</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#distinct.distinct-3.Key-2">Key</a></span></li><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../types/DistinctOptions.html" class="tsd-signature-type tsd-kind-type-alias">DistinctOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/Flatten.html" class="tsd-signature-type tsd-kind-type-alias">Flatten</a><span class="tsd-signature-symbol"><</span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#distinct.distinct-3.Key-2">Key</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L837">src/collection.ts:837</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="distinct.distinct-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">distinct</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#distinct.distinct-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L844">src/collection.ts:844</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="distinct.distinct-5" class="tsd-anchor"></a><span class="tsd-kind-call-signature">distinct</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">filter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#distinct.distinct-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></span></li><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L845">src/collection.ts:845</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="distinct.distinct-6" class="tsd-anchor"></a><span class="tsd-kind-call-signature">distinct</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#distinct.distinct-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></span></li><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../types/DistinctOptions.html" class="tsd-signature-type tsd-kind-type-alias">DistinctOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L846">src/collection.ts:846</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="drop" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>drop</span><a href="#drop" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="drop.drop-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">drop</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#drop.drop-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Drop the collection from the database, removing it permanently. New accesses will create a new collection.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/DropCollectionOptions.html" class="tsd-signature-type tsd-kind-interface">DropCollectionOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L492">src/collection.ts:492</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="dropIndex" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>drop<wbr/>Index</span><a href="#dropIndex" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="dropIndex.dropIndex-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">drop<wbr/>Index</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">indexName</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">></span><a href="#dropIndex.dropIndex-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Drops an index from this collection.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">indexName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Name of the index to drop.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/CommandOperationOptions.html" class="tsd-signature-type tsd-kind-interface">CommandOperationOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L674">src/collection.ts:674</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="dropIndexes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>drop<wbr/>Indexes</span><a href="#dropIndexes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="dropIndexes.dropIndexes-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">drop<wbr/>Indexes</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#dropIndexes.dropIndexes-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Drops all indexes from this collection.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/CommandOperationOptions.html" class="tsd-signature-type tsd-kind-interface">CommandOperationOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L689">src/collection.ts:689</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="dropSearchIndex" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>drop<wbr/>Search<wbr/>Index</span><a href="#dropSearchIndex" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="dropSearchIndex.dropSearchIndex-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">drop<wbr/>Search<wbr/>Index</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#dropSearchIndex.dropSearchIndex-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Deletes a search index by index name.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">name</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The name of the search index to be deleted.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Remarks-2" class="tsd-anchor"></a>Remarks<a href="#Remarks-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Only available when used against a 7.0+ Atlas cluster.</p>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L1257">src/collection.ts:1257</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="estimatedDocumentCount" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>estimated<wbr/>Document<wbr/>Count</span><a href="#estimatedDocumentCount" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="estimatedDocumentCount.estimatedDocumentCount-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">estimated<wbr/>Document<wbr/>Count</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">></span><a href="#estimatedDocumentCount.estimatedDocumentCount-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets an estimate of the count of documents in a collection using collection metadata.
This will always run a count command on all server versions.</p>
<p>due to an oversight in versions 5.0.0-5.0.8 of MongoDB, the count command,
which estimatedDocumentCount uses in its implementation, was not included in v1 of
the Stable API, and so users of the Stable API with estimatedDocumentCount are
recommended to upgrade their server version to 5.0.9+ or set apiStrict: false to avoid
encountering errors.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/EstimatedDocumentCountOptions.html" class="tsd-signature-type tsd-kind-interface">EstimatedDocumentCountOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="See-1" class="tsd-anchor"></a>See<a href="#See-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p><a href="https://www.mongodb.com/docs/manual/reference/command/count/#behavior|Count:">Behavior</a></p>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L765">src/collection.ts:765</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="find" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>find</span><a href="#find" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="find.find-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="FindCursor.html" class="tsd-signature-type tsd-kind-class">FindCursor</a><span class="tsd-signature-symbol"><</span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#find.find-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a cursor for a filter that can be used to iterate over results from MongoDB</p>
</div><h4 class="tsd-returns-title">Returns <a href="FindCursor.html" class="tsd-signature-type tsd-kind-class">FindCursor</a><span class="tsd-signature-symbol"><</span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L535">src/collection.ts:535</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="find.find-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="FindCursor.html" class="tsd-signature-type tsd-kind-class">FindCursor</a><span class="tsd-signature-symbol"><</span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#find.find-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/FindOptions.html" class="tsd-signature-type tsd-kind-interface">FindOptions</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> & </span><a href="../types/Abortable.html" class="tsd-signature-type tsd-kind-type-alias">Abortable</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="FindCursor.html" class="tsd-signature-type tsd-kind-class">FindCursor</a><span class="tsd-signature-symbol"><</span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L536">src/collection.ts:536</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="find.find-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#find.find-3.T-1">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="FindCursor.html" class="tsd-signature-type tsd-kind-class">FindCursor</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#find.find-3.T-1">T</a><span class="tsd-signature-symbol">></span><a href="#find.find-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="find.find-3.T-1" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/FindOptions.html" class="tsd-signature-type tsd-kind-interface">FindOptions</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> & </span><a href="../types/Abortable.html" class="tsd-signature-type tsd-kind-type-alias">Abortable</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="FindCursor.html" class="tsd-signature-type tsd-kind-class">FindCursor</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#find.find-3.T-1">T</a><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L537">src/collection.ts:537</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="findOne" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>find<wbr/>One</span><a href="#findOne" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="findOne.findOne-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOne.findOne-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Fetches the first document that matches the filter</p>
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L505">src/collection.ts:505</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOne.findOne-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOne.findOne-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L506">src/collection.ts:506</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOne.findOne-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOne.findOne-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-type">Omit</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/FindOptions.html" class="tsd-signature-type tsd-kind-interface">FindOptions</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"timeoutMode"</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> & </span><a href="../types/Abortable.html" class="tsd-signature-type tsd-kind-type-alias">Abortable</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L507">src/collection.ts:507</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOne.findOne-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#findOne.findOne-4.T-2">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#findOne.findOne-4.T-2">T</a><span class="tsd-signature-symbol">></span><a href="#findOne.findOne-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="findOne.findOne-4.T-2" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span> = <a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a></span></li></ul></section><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#findOne.findOne-4.T-2">T</a><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L513">src/collection.ts:513</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOne.findOne-5" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#findOne.findOne-5.T-3">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#findOne.findOne-5.T-3">T</a><span class="tsd-signature-symbol">></span><a href="#findOne.findOne-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="findOne.findOne-5.T-3" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span> = <a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#findOne.findOne-5.T-3">T</a><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L514">src/collection.ts:514</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOne.findOne-6" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#findOne.findOne-6.T-4">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#findOne.findOne-6.T-4">T</a><span class="tsd-signature-symbol">></span><a href="#findOne.findOne-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="findOne.findOne-6.T-4" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span> = <a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <span class="tsd-signature-type">Omit</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/FindOptions.html" class="tsd-signature-type tsd-kind-interface">FindOptions</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"timeoutMode"</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> & </span><a href="../types/Abortable.html" class="tsd-signature-type tsd-kind-type-alias">Abortable</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#findOne.findOne-6.T-4">T</a><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L515">src/collection.ts:515</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="findOneAndDelete" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>find<wbr/>One<wbr/>And<wbr/>Delete</span><a href="#findOneAndDelete" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="findOneAndDelete.findOneAndDelete-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One<wbr/>And<wbr/>Delete</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/ModifyResult.html" class="tsd-signature-type tsd-kind-interface">ModifyResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOneAndDelete.findOneAndDelete-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Find a document and delete it in one atomic operation. Requires a write lock for the duration of the operation.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The filter used to select the document to remove</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/FindOneAndDeleteOptions.html" class="tsd-signature-type tsd-kind-interface">FindOneAndDeleteOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">includeResultMetadata</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">true</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/ModifyResult.html" class="tsd-signature-type tsd-kind-interface">ModifyResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L897">src/collection.ts:897</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOneAndDelete.findOneAndDelete-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One<wbr/>And<wbr/>Delete</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOneAndDelete.findOneAndDelete-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/FindOneAndDeleteOptions.html" class="tsd-signature-type tsd-kind-interface">FindOneAndDeleteOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">includeResultMetadata</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L901">src/collection.ts:901</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOneAndDelete.findOneAndDelete-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One<wbr/>And<wbr/>Delete</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOneAndDelete.findOneAndDelete-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/FindOneAndDeleteOptions.html" class="tsd-signature-type tsd-kind-interface">FindOneAndDeleteOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L905">src/collection.ts:905</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOneAndDelete.findOneAndDelete-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One<wbr/>And<wbr/>Delete</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOneAndDelete.findOneAndDelete-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L909">src/collection.ts:909</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="findOneAndReplace" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>find<wbr/>One<wbr/>And<wbr/>Replace</span><a href="#findOneAndReplace" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="findOneAndReplace.findOneAndReplace-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One<wbr/>And<wbr/>Replace</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">replacement</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/ModifyResult.html" class="tsd-signature-type tsd-kind-interface">ModifyResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOneAndReplace.findOneAndReplace-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Find a document and replace it in one atomic operation. Requires a write lock for the duration of the operation.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The filter used to select the document to replace</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">replacement</span>: <a href="../types/WithoutId.html" class="tsd-signature-type tsd-kind-type-alias">WithoutId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The Document that replaces the matching document</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/FindOneAndReplaceOptions.html" class="tsd-signature-type tsd-kind-interface">FindOneAndReplaceOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">includeResultMetadata</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">true</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/ModifyResult.html" class="tsd-signature-type tsd-kind-interface">ModifyResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L931">src/collection.ts:931</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOneAndReplace.findOneAndReplace-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One<wbr/>And<wbr/>Replace</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">replacement</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOneAndReplace.findOneAndReplace-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">replacement</span>: <a href="../types/WithoutId.html" class="tsd-signature-type tsd-kind-type-alias">WithoutId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/FindOneAndReplaceOptions.html" class="tsd-signature-type tsd-kind-interface">FindOneAndReplaceOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">includeResultMetadata</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L936">src/collection.ts:936</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOneAndReplace.findOneAndReplace-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One<wbr/>And<wbr/>Replace</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">replacement</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOneAndReplace.findOneAndReplace-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">replacement</span>: <a href="../types/WithoutId.html" class="tsd-signature-type tsd-kind-type-alias">WithoutId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/FindOneAndReplaceOptions.html" class="tsd-signature-type tsd-kind-interface">FindOneAndReplaceOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L941">src/collection.ts:941</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOneAndReplace.findOneAndReplace-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One<wbr/>And<wbr/>Replace</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">replacement</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOneAndReplace.findOneAndReplace-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">replacement</span>: <a href="../types/WithoutId.html" class="tsd-signature-type tsd-kind-type-alias">WithoutId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L946">src/collection.ts:946</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="findOneAndUpdate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>find<wbr/>One<wbr/>And<wbr/>Update</span><a href="#findOneAndUpdate" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="findOneAndUpdate.findOneAndUpdate-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One<wbr/>And<wbr/>Update</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">update</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/ModifyResult.html" class="tsd-signature-type tsd-kind-interface">ModifyResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOneAndUpdate.findOneAndUpdate-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Find a document and update it in one atomic operation. Requires a write lock for the duration of the operation.</p>
<p>The value of <code>update</code> can be either:</p>
<ul>
<li>UpdateFilter<TSchema> - A document that contains update operator expressions,</li>
<li>Document[] - an aggregation pipeline consisting of the following stages:
<ul>
<li>$addFields and its alias $set</li>
<li>$project and its alias $unset</li>
<li>$replaceRoot and its alias $replaceWith.
See the <a href="https://www.mongodb.com/docs/manual/reference/command/findAndModify" target="_blank" class="external">findAndModify command documentation</a> for details.</li>
</ul>
</li>
</ul>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The filter used to select the document to update</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">update</span>: <a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><a href="../types/UpdateFilter.html" class="tsd-signature-type tsd-kind-type-alias">UpdateFilter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The modifications to apply</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/FindOneAndUpdateOptions.html" class="tsd-signature-type tsd-kind-interface">FindOneAndUpdateOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">includeResultMetadata</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">true</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/ModifyResult.html" class="tsd-signature-type tsd-kind-interface">ModifyResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L981">src/collection.ts:981</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOneAndUpdate.findOneAndUpdate-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One<wbr/>And<wbr/>Update</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">update</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOneAndUpdate.findOneAndUpdate-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">update</span>: <a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><a href="../types/UpdateFilter.html" class="tsd-signature-type tsd-kind-type-alias">UpdateFilter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/FindOneAndUpdateOptions.html" class="tsd-signature-type tsd-kind-interface">FindOneAndUpdateOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">includeResultMetadata</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L986">src/collection.ts:986</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOneAndUpdate.findOneAndUpdate-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One<wbr/>And<wbr/>Update</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">update</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOneAndUpdate.findOneAndUpdate-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">update</span>: <a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><a href="../types/UpdateFilter.html" class="tsd-signature-type tsd-kind-type-alias">UpdateFilter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/FindOneAndUpdateOptions.html" class="tsd-signature-type tsd-kind-interface">FindOneAndUpdateOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L991">src/collection.ts:991</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="findOneAndUpdate.findOneAndUpdate-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>One<wbr/>And<wbr/>Update</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">update</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#findOneAndUpdate.findOneAndUpdate-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li><li><span><span class="tsd-kind-parameter">update</span>: <a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><a href="../types/UpdateFilter.html" class="tsd-signature-type tsd-kind-type-alias">UpdateFilter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="../types/WithId.html" class="tsd-signature-type tsd-kind-type-alias">WithId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L996">src/collection.ts:996</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="indexes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>indexes</span><a href="#indexes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="indexes.indexes-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">indexes</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionInfo.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionInfo</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#indexes.indexes-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Retrieve all the indexes on the collection.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/IndexInformationOptions.html" class="tsd-signature-type tsd-kind-interface">IndexInformationOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">full</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">true</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionInfo.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionInfo</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L869">src/collection.ts:869</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="indexes.indexes-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">indexes</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionCompact.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionCompact</a><span class="tsd-signature-symbol">></span><a href="#indexes.indexes-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/IndexInformationOptions.html" class="tsd-signature-type tsd-kind-interface">IndexInformationOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">full</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionCompact.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionCompact</a><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L870">src/collection.ts:870</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="indexes.indexes-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">indexes</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionCompact.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionCompact</a><span class="tsd-signature-symbol"> | </span><a href="../types/IndexDescriptionInfo.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionInfo</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#indexes.indexes-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/IndexInformationOptions.html" class="tsd-signature-type tsd-kind-interface">IndexInformationOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionCompact.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionCompact</a><span class="tsd-signature-symbol"> | </span><a href="../types/IndexDescriptionInfo.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionInfo</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L871">src/collection.ts:871</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="indexes.indexes-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">indexes</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionInfo.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionInfo</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#indexes.indexes-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../types/ListIndexesOptions.html" class="tsd-signature-type tsd-kind-type-alias">ListIndexesOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionInfo.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionInfo</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L874">src/collection.ts:874</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="indexExists" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>index<wbr/>Exists</span><a href="#indexExists" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="indexExists.indexExists-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">index<wbr/>Exists</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">indexes</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#indexExists.indexExists-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Checks if one or more indexes exist on the collection, fails on first non-existing index</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">indexes</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>One or more index names to check.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../types/ListIndexesOptions.html" class="tsd-signature-type tsd-kind-type-alias">ListIndexesOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L718">src/collection.ts:718</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="indexInformation" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>index<wbr/>Information</span><a href="#indexInformation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="indexInformation.indexInformation-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">index<wbr/>Information</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionInfo.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionInfo</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#indexInformation.indexInformation-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Retrieves this collections index info.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/IndexInformationOptions.html" class="tsd-signature-type tsd-kind-interface">IndexInformationOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">full</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">true</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionInfo.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionInfo</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L733">src/collection.ts:733</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="indexInformation.indexInformation-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">index<wbr/>Information</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionCompact.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionCompact</a><span class="tsd-signature-symbol">></span><a href="#indexInformation.indexInformation-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/IndexInformationOptions.html" class="tsd-signature-type tsd-kind-interface">IndexInformationOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">full</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionCompact.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionCompact</a><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L736">src/collection.ts:736</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="indexInformation.indexInformation-3" class="tsd-anchor"></a><span class="tsd-kind-call-signature">index<wbr/>Information</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionCompact.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionCompact</a><span class="tsd-signature-symbol"> | </span><a href="../types/IndexDescriptionInfo.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionInfo</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#indexInformation.indexInformation-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/IndexInformationOptions.html" class="tsd-signature-type tsd-kind-interface">IndexInformationOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionCompact.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionCompact</a><span class="tsd-signature-symbol"> | </span><a href="../types/IndexDescriptionInfo.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionInfo</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L739">src/collection.ts:739</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="indexInformation.indexInformation-4" class="tsd-anchor"></a><span class="tsd-kind-call-signature">index<wbr/>Information</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionCompact.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionCompact</a><span class="tsd-signature-symbol">></span><a href="#indexInformation.indexInformation-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/IndexDescriptionCompact.html" class="tsd-signature-type tsd-kind-type-alias">IndexDescriptionCompact</a><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L742">src/collection.ts:742</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="initializeOrderedBulkOp" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>initialize<wbr/>Ordered<wbr/>Bulk<wbr/>Op</span><a href="#initializeOrderedBulkOp" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="initializeOrderedBulkOp.initializeOrderedBulkOp-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">initialize<wbr/>Ordered<wbr/>Bulk<wbr/>Op</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="OrderedBulkOperation.html" class="tsd-signature-type tsd-kind-class">OrderedBulkOperation</a><a href="#initializeOrderedBulkOp.initializeOrderedBulkOp-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initiate an In order bulk write operation. Operations will be serially executed in the order they are added, creating a new operation for each switch in types.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/BulkWriteOptions.html" class="tsd-signature-type tsd-kind-interface">BulkWriteOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="OrderedBulkOperation.html" class="tsd-signature-type tsd-kind-class">OrderedBulkOperation</a></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Throws-1" class="tsd-anchor"></a>Throws<a href="#Throws-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>MongoNotConnectedError</p>
<h4 class="tsd-anchor-link"><a id="Remarks-3" class="tsd-anchor"></a>Remarks<a href="#Remarks-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p><strong>NOTE:</strong> MongoClient must be connected prior to calling this method due to a known limitation in this legacy implementation.
However, <code>collection.bulkWrite()</code> provides an equivalent API that does not require prior connecting.</p>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L1164">src/collection.ts:1164</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="initializeUnorderedBulkOp" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>initialize<wbr/>Unordered<wbr/>Bulk<wbr/>Op</span><a href="#initializeUnorderedBulkOp" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="initializeUnorderedBulkOp.initializeUnorderedBulkOp-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">initialize<wbr/>Unordered<wbr/>Bulk<wbr/>Op</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="UnorderedBulkOperation.html" class="tsd-signature-type tsd-kind-class">UnorderedBulkOperation</a><a href="#initializeUnorderedBulkOp.initializeUnorderedBulkOp-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initiate an Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/BulkWriteOptions.html" class="tsd-signature-type tsd-kind-interface">BulkWriteOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="UnorderedBulkOperation.html" class="tsd-signature-type tsd-kind-class">UnorderedBulkOperation</a></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Throws-2" class="tsd-anchor"></a>Throws<a href="#Throws-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>MongoNotConnectedError</p>
<h4 class="tsd-anchor-link"><a id="Remarks-4" class="tsd-anchor"></a>Remarks<a href="#Remarks-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p><strong>NOTE:</strong> MongoClient must be connected prior to calling this method due to a known limitation in this legacy implementation.
However, <code>collection.bulkWrite()</code> provides an equivalent API that does not require prior connecting.</p>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L1152">src/collection.ts:1152</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="insertMany" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>insert<wbr/>Many</span><a href="#insertMany" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="insertMany.insertMany-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">insert<wbr/>Many</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">docs</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/InsertManyResult.html" class="tsd-signature-type tsd-kind-interface">InsertManyResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#insertMany.insertMany-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Inserts an array of documents into MongoDB. If documents passed in do not contain the <strong>_id</strong> field,
one will be added to each of the documents missing it by the driver, mutating the document. This behavior
can be overridden by setting the <strong>forceServerObjectId</strong> flag.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">docs</span>: <span class="tsd-signature-keyword">readonly </span><a href="../types/OptionalUnlessRequiredId.html" class="tsd-signature-type tsd-kind-type-alias">OptionalUnlessRequiredId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>The documents to insert</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/BulkWriteOptions.html" class="tsd-signature-type tsd-kind-interface">BulkWriteOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/InsertManyResult.html" class="tsd-signature-type tsd-kind-interface">InsertManyResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L303">src/collection.ts:303</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="insertOne" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>insert<wbr/>One</span><a href="#insertOne" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="insertOne.insertOne-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">insert<wbr/>One</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">doc</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/InsertOneResult.html" class="tsd-signature-type tsd-kind-interface">InsertOneResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#insertOne.insertOne-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Inserts a single document into MongoDB. If documents passed in do not contain the <strong>_id</strong> field,
one will be added to each of the documents missing it by the driver, mutating the document. This behavior
can be overridden by setting the <strong>forceServerObjectId</strong> flag.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">doc</span>: <a href="../types/OptionalUnlessRequiredId.html" class="tsd-signature-type tsd-kind-type-alias">OptionalUnlessRequiredId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The document to insert</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/InsertOneOptions.html" class="tsd-signature-type tsd-kind-interface">InsertOneOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/InsertOneResult.html" class="tsd-signature-type tsd-kind-interface">InsertOneResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L281">src/collection.ts:281</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="isCapped" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>is<wbr/>Capped</span><a href="#isCapped" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="isCapped.isCapped-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">is<wbr/>Capped</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#isCapped.isCapped-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns if the collection is a capped collection</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/OperationOptions.html" class="tsd-signature-type tsd-kind-interface">OperationOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L570">src/collection.ts:570</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="listIndexes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>list<wbr/>Indexes</span><a href="#listIndexes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="listIndexes.listIndexes-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">list<wbr/>Indexes</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="ListIndexesCursor.html" class="tsd-signature-type tsd-kind-class">ListIndexesCursor</a><a href="#listIndexes.listIndexes-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Get the list of all indexes information for the collection.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../types/ListIndexesOptions.html" class="tsd-signature-type tsd-kind-type-alias">ListIndexesOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="ListIndexesCursor.html" class="tsd-signature-type tsd-kind-class">ListIndexesCursor</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L708">src/collection.ts:708</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="listSearchIndexes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>list<wbr/>Search<wbr/>Indexes</span><a href="#listSearchIndexes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="listSearchIndexes.listSearchIndexes-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">list<wbr/>Search<wbr/>Indexes</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="ListSearchIndexesCursor.html" class="tsd-signature-type tsd-kind-class">ListSearchIndexesCursor</a><a href="#listSearchIndexes.listSearchIndexes-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns all search indexes for the current collection.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../types/ListSearchIndexesOptions.html" class="tsd-signature-type tsd-kind-type-alias">ListSearchIndexesOptions</a></span><div class="tsd-comment tsd-typography"><p>The options for the list indexes operation.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="ListSearchIndexesCursor.html" class="tsd-signature-type tsd-kind-class">ListSearchIndexesCursor</a></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Remarks-5" class="tsd-anchor"></a>Remarks<a href="#Remarks-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Only available when used against a 7.0+ Atlas cluster.</p>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L1194">src/collection.ts:1194</a></li></ul></aside></li><li class="tsd-signature tsd-anchor-link"><a id="listSearchIndexes.listSearchIndexes-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">list<wbr/>Search<wbr/>Indexes</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="ListSearchIndexesCursor.html" class="tsd-signature-type tsd-kind-class">ListSearchIndexesCursor</a><a href="#listSearchIndexes.listSearchIndexes-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns all search indexes for the current collection.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">name</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The name of the index to search for. Only indexes with matching index names will be returned.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../types/ListSearchIndexesOptions.html" class="tsd-signature-type tsd-kind-type-alias">ListSearchIndexesOptions</a></span><div class="tsd-comment tsd-typography"><p>The options for the list indexes operation.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="ListSearchIndexesCursor.html" class="tsd-signature-type tsd-kind-class">ListSearchIndexesCursor</a></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Remarks-6" class="tsd-anchor"></a>Remarks<a href="#Remarks-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Only available when used against a 7.0+ Atlas cluster.</p>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L1203">src/collection.ts:1203</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="options" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>options</span><a href="#options" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="options.options-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">options</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">></span><a href="#options.options-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns the options of the collection.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/OperationOptions.html" class="tsd-signature-type tsd-kind-interface">OperationOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L558">src/collection.ts:558</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="rename" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>rename</span><a href="#rename" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="rename.rename-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">rename</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">newName</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="Collection.html" class="tsd-signature-type tsd-kind-class">Collection</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#rename.rename-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Rename the collection.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">newName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>New name of of the collection.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/RenameOptions.html" class="tsd-signature-type tsd-kind-interface">RenameOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="Collection.html" class="tsd-signature-type tsd-kind-class">Collection</a><span class="tsd-signature-symbol"><</span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Remarks-7" class="tsd-anchor"></a>Remarks<a href="#Remarks-7" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>This operation does not inherit options from the Db or MongoClient.</p>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L472">src/collection.ts:472</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="replaceOne" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>replace<wbr/>One</span><a href="#replaceOne" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="replaceOne.replaceOne-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">replace<wbr/>One</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">replacement</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/UpdateResult.html" class="tsd-signature-type tsd-kind-interface">UpdateResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#replaceOne.replaceOne-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Replace a document in a collection with another document</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The filter used to select the document to replace</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">replacement</span>: <a href="../types/WithoutId.html" class="tsd-signature-type tsd-kind-type-alias">WithoutId</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The Document that replaces the matching document</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/ReplaceOptions.html" class="tsd-signature-type tsd-kind-interface">ReplaceOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/UpdateResult.html" class="tsd-signature-type tsd-kind-interface">UpdateResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L388">src/collection.ts:388</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="updateMany" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>update<wbr/>Many</span><a href="#updateMany" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="updateMany.updateMany-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">update<wbr/>Many</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">update</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/UpdateResult.html" class="tsd-signature-type tsd-kind-interface">UpdateResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#updateMany.updateMany-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Update multiple documents in a collection</p>
<p>The value of <code>update</code> can be either:</p>
<ul>
<li>UpdateFilter<TSchema> - A document that contains update operator expressions,</li>
<li>Document[] - an aggregation pipeline.</li>
</ul>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The filter used to select the document to update</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">update</span>: <a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><a href="../types/UpdateFilter.html" class="tsd-signature-type tsd-kind-type-alias">UpdateFilter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The modifications to apply</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/UpdateOptions.html" class="tsd-signature-type tsd-kind-interface">UpdateOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/UpdateResult.html" class="tsd-signature-type tsd-kind-interface">UpdateResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L415">src/collection.ts:415</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="updateOne" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>update<wbr/>One</span><a href="#updateOne" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="updateOne.updateOne-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">update<wbr/>One</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">filter</span>, <span class="tsd-kind-parameter">update</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/UpdateResult.html" class="tsd-signature-type tsd-kind-interface">UpdateResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#updateOne.updateOne-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Update a single document in a collection</p>
<p>The value of <code>update</code> can be either:</p>
<ul>
<li>UpdateFilter<TSchema> - A document that contains update operator expressions,</li>
<li>Document[] - an aggregation pipeline.</li>
</ul>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">filter</span>: <a href="../types/Filter.html" class="tsd-signature-type tsd-kind-type-alias">Filter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The filter used to select the document to update</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">update</span>: <a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><a href="../types/UpdateFilter.html" class="tsd-signature-type tsd-kind-type-alias">UpdateFilter</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>The modifications to apply</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/UpdateOptions.html" class="tsd-signature-type tsd-kind-interface">UpdateOptions</a></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/UpdateResult.html" class="tsd-signature-type tsd-kind-interface">UpdateResult</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L365">src/collection.ts:365</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="updateSearchIndex" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>update<wbr/>Search<wbr/>Index</span><a href="#updateSearchIndex" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="updateSearchIndex.updateSearchIndex-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">update<wbr/>Search<wbr/>Index</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span>, <span class="tsd-kind-parameter">definition</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#updateSearchIndex.updateSearchIndex-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Updates a search index by replacing the existing index definition with the provided definition.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">name</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The name of the search index to update.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">definition</span>: <a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a></span><div class="tsd-comment tsd-typography"><p>The new search index definition.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Remarks-8" class="tsd-anchor"></a>Remarks<a href="#Remarks-8" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Only available when used against a 7.0+ Atlas cluster.</p>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L1272">src/collection.ts:1272</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="watch" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>watch</span><a href="#watch" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="watch.watch-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">watch</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#watch.watch-1.TLocal">TLocal</a><span class="tsd-signature-symbol">, </span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#watch.watch-1.TChange">TChange</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">pipeline</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="ChangeStream.html" class="tsd-signature-type tsd-kind-class">ChangeStream</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#watch.watch-1.TLocal">TLocal</a><span class="tsd-signature-symbol">, </span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#watch.watch-1.TChange">TChange</a><span class="tsd-signature-symbol">></span><a href="#watch.watch-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Create a new Change Stream, watching for new changes (insertions, updates, replacements, deletions, and invalidations) in this collection.</p>
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="watch.watch-1.TLocal" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">TLocal</span><span class="tsd-signature-keyword"> extends </span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a> = <a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#TSchema">TSchema</a></span><div class="tsd-comment tsd-typography"><p>Type of the data being detected by the change stream</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><a id="watch.watch-1.TChange" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">TChange</span><span class="tsd-signature-keyword"> extends </span><a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a> = <a href="../types/ChangeStreamDocument.html" class="tsd-signature-type tsd-kind-type-alias">ChangeStreamDocument</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#watch.watch-1.TLocal">TLocal</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>Type of the whole change stream document emitted</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">pipeline</span>: <a href="../interfaces/BSON.Document.html" class="tsd-signature-type tsd-kind-interface">Document</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> = []</span></span><div class="tsd-comment tsd-typography"><p>An array of <a href="https://www.mongodb.com/docs/manual/reference/operator/aggregation-pipeline/|aggregation">pipeline stages</a> through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/ChangeStreamOptions.html" class="tsd-signature-type tsd-kind-interface">ChangeStreamOptions</a><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>Optional settings for the command</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="ChangeStream.html" class="tsd-signature-type tsd-kind-class">ChangeStream</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#watch.watch-1.TLocal">TLocal</a><span class="tsd-signature-symbol">, </span><a class="tsd-signature-type tsd-kind-type-parameter" href="Collection.html#watch.watch-1.TChange">TChange</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Remarks-9" class="tsd-anchor"></a>Remarks<a href="#Remarks-9" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>watch() accepts two generic arguments for distinct use cases:</p>
<ul>
<li>The first is to override the schema that may be defined for this specific collection</li>
<li>The second is to override the shape of the change stream document entirely, if it is not provided the type will default to ChangeStreamDocument of the first argument</li>
</ul>
<h4 class="tsd-anchor-link"><a id="Example-3" class="tsd-anchor"></a>Example<a href="#Example-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>By just providing the first argument I can type the change to be <code>ChangeStreamDocument<{ _id: number }></code></p>
<pre><code class="ts"><span class="hl-6">collection</span><span class="hl-1">.</span><span class="hl-0">watch</span><span class="hl-1"><{ </span><span class="hl-6">_id</span><span class="hl-1">: </span><span class="hl-9">number</span><span class="hl-1"> }>()</span><br/><span class="hl-1"> .</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'change'</span><span class="hl-1">, </span><span class="hl-6">change</span><span class="hl-1"> </span><span class="hl-2">=></span><span class="hl-1"> </span><span class="hl-6">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-6">change</span><span class="hl-1">.</span><span class="hl-6">_id</span><span class="hl-1">.</span><span class="hl-0">toFixed</span><span class="hl-1">(</span><span class="hl-8">4</span><span class="hl-1">)));</span>
</code><button type="button">Copy</button></pre>
<h4 class="tsd-anchor-link"><a id="Example-4" class="tsd-anchor"></a>Example<a href="#Example-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Passing a second argument provides a way to reflect the type changes caused by an advanced pipeline.
Here, we are using a pipeline to have MongoDB filter for insert changes only and add a comment.
No need start from scratch on the ChangeStreamInsertDocument type!
By using an intersection we can save time and ensure defaults remain the same type!</p>
<pre><code class="ts"><span class="hl-6">collection</span><br/><span class="hl-1"> .</span><span class="hl-0">watch</span><span class="hl-1"><</span><span class="hl-9">Schema</span><span class="hl-1">, </span><span class="hl-9">ChangeStreamInsertDocument</span><span class="hl-1"><</span><span class="hl-9">Schema</span><span class="hl-1">> & { </span><span class="hl-6">comment</span><span class="hl-1">: </span><span class="hl-9">string</span><span class="hl-1"> }>([</span><br/><span class="hl-1"> { </span><span class="hl-6">$addFields:</span><span class="hl-1"> { </span><span class="hl-6">comment:</span><span class="hl-1"> </span><span class="hl-3">'big changes'</span><span class="hl-1"> } },</span><br/><span class="hl-1"> { </span><span class="hl-6">$match:</span><span class="hl-1"> { </span><span class="hl-6">operationType:</span><span class="hl-1"> </span><span class="hl-3">'insert'</span><span class="hl-1"> } }</span><br/><span class="hl-1"> ])</span><br/><span class="hl-1"> .</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'change'</span><span class="hl-1">, </span><span class="hl-6">change</span><span class="hl-1"> </span><span class="hl-2">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">change</span><span class="hl-1">.</span><span class="hl-6">comment</span><span class="hl-1">.</span><span class="hl-0">startsWith</span><span class="hl-1">(</span><span class="hl-3">'big'</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-6">change</span><span class="hl-1">.</span><span class="hl-6">operationType</span><span class="hl-1"> === </span><span class="hl-3">'insert'</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-5">// No need to narrow in code because the generics did that for us!</span><br/><span class="hl-1"> </span><span class="hl-0">expectType</span><span class="hl-1"><</span><span class="hl-9">Schema</span><span class="hl-1">>(</span><span class="hl-6">change</span><span class="hl-1">.</span><span class="hl-6">fullDocument</span><span class="hl-1">);</span><br/><span class="hl-1"> });</span>
</code><button type="button">Copy</button></pre>
<h4 class="tsd-anchor-link"><a id="Example-5" class="tsd-anchor"></a>Example<a href="#Example-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>In iterator mode, if a next() call throws a timeout error, it will attempt to resume the change stream.
The next call can just be retried after this succeeds.</p>
<pre><code class="ts"><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-4">changeStream</span><span class="hl-1"> = </span><span class="hl-6">collection</span><span class="hl-1">.</span><span class="hl-0">watch</span><span class="hl-1">([], { </span><span class="hl-6">timeoutMS:</span><span class="hl-1"> </span><span class="hl-8">100</span><span class="hl-1"> });</span><br/><span class="hl-7">try</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">await</span><span class="hl-1"> </span><span class="hl-6">changeStream</span><span class="hl-1">.</span><span class="hl-0">next</span><span class="hl-1">();</span><br/><span class="hl-1">} </span><span class="hl-7">catch</span><span class="hl-1"> (</span><span class="hl-6">e</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-7">if</span><span class="hl-1"> (</span><span class="hl-6">e</span><span class="hl-1"> </span><span class="hl-2">instanceof</span><span class="hl-1"> </span><span class="hl-9">MongoOperationTimeoutError</span><span class="hl-1"> && !</span><span class="hl-6">changeStream</span><span class="hl-1">.</span><span class="hl-6">closed</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-7">await</span><span class="hl-1"> </span><span class="hl-6">changeStream</span><span class="hl-1">.</span><span class="hl-0">next</span><span class="hl-1">();</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-7">throw</span><span class="hl-1"> </span><span class="hl-6">e</span><span class="hl-1">;</span><br/><span class="hl-1">}</span>
</code><button type="button">Copy</button></pre>
<h4 class="tsd-anchor-link"><a id="Example-6" class="tsd-anchor"></a>Example<a href="#Example-6" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>In emitter mode, if the change stream goes <code>timeoutMS</code> without emitting a change event, it will
emit an error event that returns a MongoOperationTimeoutError, but will not close the change
stream unless the resume attempt fails. There is no need to re-establish change listeners as
this will automatically continue emitting change events once the resume attempt completes.</p>
<pre><code class="ts"><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-4">changeStream</span><span class="hl-1"> = </span><span class="hl-6">collection</span><span class="hl-1">.</span><span class="hl-0">watch</span><span class="hl-1">([], { </span><span class="hl-6">timeoutMS:</span><span class="hl-1"> </span><span class="hl-8">100</span><span class="hl-1"> });</span><br/><span class="hl-6">changeStream</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'change'</span><span class="hl-1">, </span><span class="hl-6">console</span><span class="hl-1">.</span><span class="hl-6">log</span><span class="hl-1">);</span><br/><span class="hl-6">changeStream</span><span class="hl-1">.</span><span class="hl-0">on</span><span class="hl-1">(</span><span class="hl-3">'error'</span><span class="hl-1">, </span><span class="hl-6">e</span><span class="hl-1"> </span><span class="hl-2">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-7">if</span><span class="hl-1"> (</span><span class="hl-6">e</span><span class="hl-1"> </span><span class="hl-2">instanceof</span><span class="hl-1"> </span><span class="hl-9">MongoOperationTimeoutError</span><span class="hl-1"> && !</span><span class="hl-6">changeStream</span><span class="hl-1">.</span><span class="hl-6">closed</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">// do nothing</span><br/><span class="hl-1"> } </span><span class="hl-7">else</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">changeStream</span><span class="hl-1">.</span><span class="hl-0">close</span><span class="hl-1">();</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">});</span>
</code><button type="button">Copy</button></pre>
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/main/src/collection.ts#L1131">src/collection.ts:1131</a></li></ul></aside></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-alpha" name="alpha"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Alpha</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-beta" name="beta"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Beta</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Accessors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Accessors</summary><div><a href="#bsonOptions" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>bson<wbr/>Options</span></a><a href="#collectionName" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>collection<wbr/>Name</span></a><a href="#dbName" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>db<wbr/>Name</span></a><a href="#hint" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>hint</span></a><a href="#namespace" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>namespace</span></a><a href="#readConcern" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>read<wbr/>Concern</span></a><a href="#readPreference" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>read<wbr/>Preference</span></a><a href="#timeoutMS" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>timeoutMS</span></a><a href="#writeConcern" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>write<wbr/>Concern</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#aggregate" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>aggregate</span></a><a href="#bulkWrite" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>bulk<wbr/>Write</span></a><a href="#count" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>count</span></a><a href="#countDocuments" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>count<wbr/>Documents</span></a><a href="#createIndex" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Index</span></a><a href="#createIndexes" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Indexes</span></a><a href="#createSearchIndex" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Search<wbr/>Index</span></a><a href="#createSearchIndexes" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>create<wbr/>Search<wbr/>Indexes</span></a><a href="#deleteMany" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>delete<wbr/>Many</span></a><a href="#deleteOne" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>delete<wbr/>One</span></a><a href="#distinct" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>distinct</span></a><a href="#drop" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop</span></a><a href="#dropIndex" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop<wbr/>Index</span></a><a href="#dropIndexes" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop<wbr/>Indexes</span></a><a href="#dropSearchIndex" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>drop<wbr/>Search<wbr/>Index</span></a><a href="#estimatedDocumentCount" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>estimated<wbr/>Document<wbr/>Count</span></a><a href="#find" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find</span></a><a href="#findOne" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find<wbr/>One</span></a><a href="#findOneAndDelete" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find<wbr/>One<wbr/>And<wbr/>Delete</span></a><a href="#findOneAndReplace" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find<wbr/>One<wbr/>And<wbr/>Replace</span></a><a href="#findOneAndUpdate" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find<wbr/>One<wbr/>And<wbr/>Update</span></a><a href="#indexes" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>indexes</span></a><a href="#indexExists" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>index<wbr/>Exists</span></a><a href="#indexInformation" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>index<wbr/>Information</span></a><a href="#initializeOrderedBulkOp" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>initialize<wbr/>Ordered<wbr/>Bulk<wbr/>Op</span></a><a href="#initializeUnorderedBulkOp" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>initialize<wbr/>Unordered<wbr/>Bulk<wbr/>Op</span></a><a href="#insertMany" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>insert<wbr/>Many</span></a><a href="#insertOne" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>insert<wbr/>One</span></a><a href="#isCapped" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Capped</span></a><a href="#listIndexes" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>list<wbr/>Indexes</span></a><a href="#listSearchIndexes" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>list<wbr/>Search<wbr/>Indexes</span></a><a href="#options" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>options</span></a><a href="#rename" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>rename</span></a><a href="#replaceOne" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>replace<wbr/>One</span></a><a href="#updateMany" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>Many</span></a><a href="#updateOne" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>One</span></a><a href="#updateSearchIndex" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>Search<wbr/>Index</span></a><a href="#watch" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>watch</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>mongodb</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>