@qp-mongosh/service-provider-core 0.0.0-dev.5 → 0.0.0-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -2
- package/.eslintrc.js +1 -1
- package/AUTHORS +11 -11
- package/LICENSE +200 -200
- package/lib/admin.d.ts +28 -28
- package/lib/admin.js +2 -2
- package/lib/all-fle-types.d.ts +2 -2
- package/lib/all-fle-types.js +2 -2
- package/lib/all-transport-types.d.ts +1 -1
- package/lib/all-transport-types.js +2 -2
- package/lib/bulk-write-result.d.ts +16 -0
- package/lib/bulk-write-result.js +3 -0
- package/lib/bulk-write-result.js.map +1 -0
- package/lib/cli-options.d.ts +43 -43
- package/lib/cli-options.js +2 -2
- package/lib/closable.d.ts +4 -4
- package/lib/closable.js +2 -2
- package/lib/command-options.d.ts +4 -0
- package/lib/command-options.js +3 -0
- package/lib/command-options.js.map +1 -0
- package/lib/connect-info.d.ts +19 -19
- package/lib/connect-info.js +34 -34
- package/lib/cursor.d.ts +34 -0
- package/lib/cursor.js +3 -0
- package/lib/cursor.js.map +1 -0
- package/lib/database-options.d.ts +8 -0
- package/lib/database-options.js +3 -0
- package/lib/database-options.js.map +1 -0
- package/lib/document.d.ts +3 -0
- package/lib/document.js +3 -0
- package/lib/document.js.map +1 -0
- package/lib/fast-failure-connect.d.ts +1 -0
- package/lib/fast-failure-connect.js +15 -0
- package/lib/fast-failure-connect.js.map +1 -0
- package/lib/index.d.ts +31 -31
- package/lib/index.js +55 -55
- package/lib/platform.d.ts +6 -6
- package/lib/platform.js +10 -10
- package/lib/printable-bson.d.ts +3 -3
- package/lib/printable-bson.js +81 -81
- package/lib/read-concern.d.ts +3 -0
- package/lib/read-concern.js +3 -0
- package/lib/read-concern.js.map +1 -0
- package/lib/read-preference.d.ts +4 -0
- package/lib/read-preference.js +3 -0
- package/lib/read-preference.js.map +1 -0
- package/lib/readable.d.ts +18 -18
- package/lib/readable.js +2 -2
- package/lib/result.d.ts +2 -0
- package/lib/result.js +3 -0
- package/lib/result.js.map +1 -0
- package/lib/service-provider.d.ts +11 -11
- package/lib/service-provider.js +18 -18
- package/lib/shell-auth-options.d.ts +7 -7
- package/lib/shell-auth-options.js +2 -2
- package/lib/textencoder-polyfill.d.ts +2 -2
- package/lib/textencoder-polyfill.js +21 -21
- package/lib/uri-generator.d.ts +8 -8
- package/lib/uri-generator.js +175 -175
- package/lib/writable.d.ts +22 -22
- package/lib/writable.js +2 -2
- package/lib/write-concern.d.ts +5 -0
- package/lib/write-concern.js +3 -0
- package/lib/write-concern.js.map +1 -0
- package/package.json +54 -54
- package/src/admin.ts +119 -119
- package/src/all-fle-types.ts +17 -17
- package/src/all-transport-types.ts +80 -80
- package/src/cli-options.ts +49 -49
- package/src/closable.ts +14 -14
- package/src/connect-info.spec.ts +192 -192
- package/src/connect-info.ts +57 -57
- package/src/index.ts +62 -62
- package/src/platform.ts +6 -6
- package/src/printable-bson.spec.ts +75 -75
- package/src/printable-bson.ts +103 -103
- package/src/readable.ts +242 -242
- package/src/service-provider.ts +23 -23
- package/src/shell-auth-options.ts +7 -7
- package/src/textencoder-polyfill.spec.ts +11 -11
- package/src/textencoder-polyfill.ts +30 -30
- package/src/uri-generator.spec.ts +481 -481
- package/src/uri-generator.ts +265 -265
- package/src/writable.ts +367 -367
- package/tsconfig.json +12 -12
- package/tsconfig.lint.json +8 -8
package/src/writable.ts
CHANGED
|
@@ -1,367 +1,367 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
Document,
|
|
3
|
-
InsertOneOptions,
|
|
4
|
-
InsertOneResult,
|
|
5
|
-
Collection,
|
|
6
|
-
RenameOptions,
|
|
7
|
-
FindOneAndDeleteOptions,
|
|
8
|
-
FindOneAndReplaceOptions,
|
|
9
|
-
FindOneAndUpdateOptions,
|
|
10
|
-
BulkWriteOptions,
|
|
11
|
-
AnyBulkWriteOperation,
|
|
12
|
-
DeleteOptions,
|
|
13
|
-
DeleteResult,
|
|
14
|
-
InsertManyResult,
|
|
15
|
-
ReplaceOptions,
|
|
16
|
-
UpdateResult,
|
|
17
|
-
UpdateOptions,
|
|
18
|
-
DropDatabaseOptions,
|
|
19
|
-
CreateIndexesOptions,
|
|
20
|
-
DropCollectionOptions,
|
|
21
|
-
BulkWriteResult,
|
|
22
|
-
RunCommandOptions,
|
|
23
|
-
DbOptions,
|
|
24
|
-
OrderedBulkOperation,
|
|
25
|
-
UnorderedBulkOperation
|
|
26
|
-
} from './all-transport-types';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Interface for write operations in the CRUD specification.
|
|
30
|
-
*/
|
|
31
|
-
export default interface Writable {
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @param {String} db - the db name
|
|
35
|
-
* @param spec
|
|
36
|
-
* @param options
|
|
37
|
-
* @param {DbOptions} dbOptions - The database options
|
|
38
|
-
* @return {Promise<Document>}
|
|
39
|
-
*/
|
|
40
|
-
runCommand(
|
|
41
|
-
db: string,
|
|
42
|
-
spec: Document,
|
|
43
|
-
options: RunCommandOptions,
|
|
44
|
-
dbOptions?: DbOptions
|
|
45
|
-
): Promise<Document>;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @param {String} db - the db name
|
|
49
|
-
* @param spec
|
|
50
|
-
* @param options
|
|
51
|
-
* @param {DbOptions} dbOptions - The database options
|
|
52
|
-
* @return {Promise<Document>}
|
|
53
|
-
*/
|
|
54
|
-
runCommandWithCheck(
|
|
55
|
-
db: string,
|
|
56
|
-
spec: Document,
|
|
57
|
-
options: RunCommandOptions,
|
|
58
|
-
dbOptions?: DbOptions
|
|
59
|
-
): Promise<Document>;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Drop a database
|
|
63
|
-
*
|
|
64
|
-
* @param {String} database - The database name.
|
|
65
|
-
* @param {Document} options - The options.
|
|
66
|
-
* @param {DbOptions} dbOptions - The database options
|
|
67
|
-
*
|
|
68
|
-
* @returns {Promise<Document>} The result of the operation.
|
|
69
|
-
*/
|
|
70
|
-
dropDatabase(
|
|
71
|
-
database: string,
|
|
72
|
-
options: DropDatabaseOptions,
|
|
73
|
-
dbOptions?: DbOptions
|
|
74
|
-
): Promise<Document>;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Execute a mix of write operations.
|
|
78
|
-
*
|
|
79
|
-
* @param {String} database - The database name.
|
|
80
|
-
* @param {String} collection - The collection name.
|
|
81
|
-
* @param {Document} requests - The bulk write requests.
|
|
82
|
-
* @param {Document} options - The bulk write options.
|
|
83
|
-
* @param {DbOptions} dbOptions - The database options
|
|
84
|
-
*
|
|
85
|
-
* @returns {Promise} The promise of the result.
|
|
86
|
-
*/
|
|
87
|
-
bulkWrite(
|
|
88
|
-
database: string,
|
|
89
|
-
collection: string,
|
|
90
|
-
requests: AnyBulkWriteOperation[],
|
|
91
|
-
options: BulkWriteOptions,
|
|
92
|
-
dbOptions?: DbOptions): Promise<BulkWriteResult>;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Delete multiple documents from the collection.
|
|
96
|
-
*
|
|
97
|
-
* @param {String} database - The database name.
|
|
98
|
-
* @param {String} collection - The collection name.
|
|
99
|
-
* @param {Document} filter - The filter.
|
|
100
|
-
* @param {Document} options - The delete many options.
|
|
101
|
-
* @param {DbOptions} dbOptions - The database options
|
|
102
|
-
*
|
|
103
|
-
* @returns {Promise} The promise of the result.
|
|
104
|
-
*/
|
|
105
|
-
deleteMany(
|
|
106
|
-
database: string,
|
|
107
|
-
collection: string,
|
|
108
|
-
filter: Document,
|
|
109
|
-
options: DeleteOptions,
|
|
110
|
-
dbOptions?: DbOptions): Promise<DeleteResult>;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Delete one document from the collection.
|
|
114
|
-
*
|
|
115
|
-
* @param {String} database - The database name.
|
|
116
|
-
* @param {String} collection - The collection name.
|
|
117
|
-
* @param {Document} filter - The filter.
|
|
118
|
-
* @param {Document} options - The delete one options.
|
|
119
|
-
* @param {DbOptions} dbOptions - The database options
|
|
120
|
-
*
|
|
121
|
-
* @returns {Promise} The promise of the result.
|
|
122
|
-
*/
|
|
123
|
-
deleteOne(
|
|
124
|
-
database: string,
|
|
125
|
-
collection: string,
|
|
126
|
-
filter: Document,
|
|
127
|
-
options: DeleteOptions,
|
|
128
|
-
dbOptions?: DbOptions): Promise<DeleteResult>;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Find one document and delete it.
|
|
132
|
-
*
|
|
133
|
-
* @param {String} database - The database name.
|
|
134
|
-
* @param {String} collection - The collection name.
|
|
135
|
-
* @param {Document} filter - The filter.
|
|
136
|
-
* @param {Document} options - The find options.
|
|
137
|
-
* @param {DbOptions} dbOptions - The database options
|
|
138
|
-
*
|
|
139
|
-
* @returns {Promise} The promise of the result.
|
|
140
|
-
*/
|
|
141
|
-
findOneAndDelete(
|
|
142
|
-
database: string,
|
|
143
|
-
collection: string,
|
|
144
|
-
filter: Document,
|
|
145
|
-
options: FindOneAndDeleteOptions,
|
|
146
|
-
dbOptions?: DbOptions): Promise<Document>;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Find one document and replace it.
|
|
150
|
-
*
|
|
151
|
-
* @param {String} database - The database name.
|
|
152
|
-
* @param {String} collection - The collection name.
|
|
153
|
-
* @param {Document} filter - The filter.
|
|
154
|
-
* @param {Document} replacement - The replacement.
|
|
155
|
-
* @param {Document} options - The find options.
|
|
156
|
-
* @param {DbOptions} dbOptions - The database options
|
|
157
|
-
*
|
|
158
|
-
* @returns {Promise} The promise of the result.
|
|
159
|
-
*/
|
|
160
|
-
findOneAndReplace(
|
|
161
|
-
database: string,
|
|
162
|
-
collection: string,
|
|
163
|
-
filter: Document,
|
|
164
|
-
replacement: Document,
|
|
165
|
-
options: FindOneAndReplaceOptions,
|
|
166
|
-
dbOptions?: DbOptions): Promise<Document>;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Find one document and update it.
|
|
170
|
-
*
|
|
171
|
-
* @param {String} database - The database name.
|
|
172
|
-
* @param {String} collection - The collection name.
|
|
173
|
-
* @param {Document} filter - The filter.
|
|
174
|
-
* @param {(Document|Array)} update - The update.
|
|
175
|
-
* @param {Document} options - The find options.
|
|
176
|
-
* @param {DbOptions} dbOptions - The DB options
|
|
177
|
-
*
|
|
178
|
-
* @returns {Promise} The promise of the result.
|
|
179
|
-
*/
|
|
180
|
-
findOneAndUpdate(
|
|
181
|
-
database: string,
|
|
182
|
-
collection: string,
|
|
183
|
-
filter: Document,
|
|
184
|
-
update: Document | Document[],
|
|
185
|
-
options: FindOneAndUpdateOptions,
|
|
186
|
-
dbOptions?: DbOptions): Promise<Document>;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Insert many documents into the colleciton.
|
|
190
|
-
*
|
|
191
|
-
* @param {String} database - The database name.
|
|
192
|
-
* @param {String} collection - The collection name.
|
|
193
|
-
* @param {Array} docs - The documents.
|
|
194
|
-
* @param {Document} options - The insert many options.
|
|
195
|
-
* @param {DbOptions} dbOptions - The DB options
|
|
196
|
-
*
|
|
197
|
-
* @returns {Promise} The promise of the result.
|
|
198
|
-
*/
|
|
199
|
-
insertMany(
|
|
200
|
-
database: string,
|
|
201
|
-
collection: string,
|
|
202
|
-
docs: Document[],
|
|
203
|
-
options: BulkWriteOptions,
|
|
204
|
-
dbOptions?: DbOptions): Promise<InsertManyResult>;
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Insert one document into the collection.
|
|
208
|
-
*
|
|
209
|
-
* @param {String} database - The database name.
|
|
210
|
-
* @param {String} collection - The collection name.
|
|
211
|
-
* @param {Document} doc - The document.
|
|
212
|
-
* @param {Document} options - The insert one options.
|
|
213
|
-
* @param {DbOptions} dbOptions - The DB options
|
|
214
|
-
*
|
|
215
|
-
* @returns {Promise} The promise of the result.
|
|
216
|
-
*/
|
|
217
|
-
insertOne(
|
|
218
|
-
database: string,
|
|
219
|
-
collection: string,
|
|
220
|
-
doc: Document,
|
|
221
|
-
options: InsertOneOptions,
|
|
222
|
-
dbOptions?: DbOptions): Promise<InsertOneResult>;
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Replace a document with another.
|
|
226
|
-
*
|
|
227
|
-
* @param {String} database - The database name.
|
|
228
|
-
* @param {String} collection - The collection name.
|
|
229
|
-
* @param {Document} filter - The filter.
|
|
230
|
-
* @param {Document} replacement - The replacement document for matches.
|
|
231
|
-
* @param {Document} options - The replace options.
|
|
232
|
-
* @param {DbOptions} dbOptions - The DB options
|
|
233
|
-
*
|
|
234
|
-
* @returns {Promise} The promise of the result.
|
|
235
|
-
*/
|
|
236
|
-
replaceOne(
|
|
237
|
-
database: string,
|
|
238
|
-
collection: string,
|
|
239
|
-
filter: Document,
|
|
240
|
-
replacement: Document,
|
|
241
|
-
options?: ReplaceOptions,
|
|
242
|
-
dbOptions?: DbOptions): Promise<UpdateResult>;
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Update many document.
|
|
246
|
-
*
|
|
247
|
-
* @param {String} database - The database name.
|
|
248
|
-
* @param {String} collection - The collection name.
|
|
249
|
-
* @param {Document} filter - The filter.
|
|
250
|
-
* @param {(Document|Array)} update - The updates.
|
|
251
|
-
* @param {Document} options - The update options.
|
|
252
|
-
* @param {DbOptions} dbOptions - The DB options
|
|
253
|
-
*
|
|
254
|
-
* @returns {Promise} The promise of the result.
|
|
255
|
-
*/
|
|
256
|
-
updateMany(
|
|
257
|
-
database: string,
|
|
258
|
-
collection: string,
|
|
259
|
-
filter: Document,
|
|
260
|
-
update: Document,
|
|
261
|
-
options?: UpdateOptions,
|
|
262
|
-
dbOptions?: DbOptions): Promise<UpdateResult>;
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Update a document.
|
|
266
|
-
*
|
|
267
|
-
* @param {String} database - The database name.
|
|
268
|
-
* @param {String} collection - The collection name.
|
|
269
|
-
* @param {Document} filter - The filter.
|
|
270
|
-
* @param {(Document|Array)} update - The updates.
|
|
271
|
-
* @param {Document} options - The update options.
|
|
272
|
-
* @param {DbOptions} dbOptions - The DB options
|
|
273
|
-
*
|
|
274
|
-
* @returns {Promise} The promise of the result.
|
|
275
|
-
*/
|
|
276
|
-
updateOne(
|
|
277
|
-
database: string,
|
|
278
|
-
collection: string,
|
|
279
|
-
filter: Document,
|
|
280
|
-
update: Document,
|
|
281
|
-
options?: UpdateOptions,
|
|
282
|
-
dbOptions?: DbOptions): Promise<UpdateResult>;
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Deprecated remove command.
|
|
286
|
-
*
|
|
287
|
-
* @param {String} database - The db name.
|
|
288
|
-
* @param {String} collection - The collection name.
|
|
289
|
-
* @param {Object} query - The query.
|
|
290
|
-
* @param {Object} options - The options.
|
|
291
|
-
* @param {DbOptions} dbOptions - The database options
|
|
292
|
-
*
|
|
293
|
-
* @return {Promise}
|
|
294
|
-
*/
|
|
295
|
-
remove(
|
|
296
|
-
database: string,
|
|
297
|
-
collection: string,
|
|
298
|
-
query: Document,
|
|
299
|
-
options?: DeleteOptions,
|
|
300
|
-
dbOptions?: DbOptions): Promise<DeleteResult>;
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Adds new indexes to a collection.
|
|
304
|
-
*
|
|
305
|
-
* @param {String} database - The db name.
|
|
306
|
-
* @param {String} collection - The collection name.
|
|
307
|
-
* @param {Object[]} indexSpecs the spec of the indexes to be created.
|
|
308
|
-
* @param {Object} options - The command options.
|
|
309
|
-
* @param {DbOptions} dbOptions - The database options
|
|
310
|
-
* @return {Promise}
|
|
311
|
-
*/
|
|
312
|
-
createIndexes(
|
|
313
|
-
database: string,
|
|
314
|
-
collection: string,
|
|
315
|
-
indexSpecs: Document[],
|
|
316
|
-
options?: CreateIndexesOptions,
|
|
317
|
-
dbOptions?: DbOptions): Promise<string[]>;
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Drops a collection.
|
|
321
|
-
*
|
|
322
|
-
* @param {String} database - The db name.
|
|
323
|
-
* @param {String} collection - The collection name.
|
|
324
|
-
* @param options
|
|
325
|
-
* @param {DbOptions} dbOptions - The database options
|
|
326
|
-
*
|
|
327
|
-
* @return {Promise}
|
|
328
|
-
*/
|
|
329
|
-
dropCollection(
|
|
330
|
-
database: string,
|
|
331
|
-
collection: string,
|
|
332
|
-
options: DropCollectionOptions,
|
|
333
|
-
dbOptions?: DbOptions
|
|
334
|
-
): Promise<boolean>;
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* @param {String} database - The db name.
|
|
338
|
-
* @param {String} oldName - The collection name.
|
|
339
|
-
* @param {String} newName - The new collection name.
|
|
340
|
-
* @param {String} options - The options.
|
|
341
|
-
* @param {DbOptions} dbOptions - The database options
|
|
342
|
-
*/
|
|
343
|
-
renameCollection(
|
|
344
|
-
database: string,
|
|
345
|
-
oldName: string,
|
|
346
|
-
newName: string,
|
|
347
|
-
options?: RenameOptions,
|
|
348
|
-
dbOptions?: DbOptions): Promise<Collection>;
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Initialize a bulk operation.
|
|
352
|
-
*
|
|
353
|
-
* @param dbName
|
|
354
|
-
* @param collName
|
|
355
|
-
* @param ordered
|
|
356
|
-
* @param options
|
|
357
|
-
* @param dbOptions
|
|
358
|
-
*/
|
|
359
|
-
initializeBulkOp(
|
|
360
|
-
dbName: string,
|
|
361
|
-
collName: string,
|
|
362
|
-
ordered: boolean,
|
|
363
|
-
options?: BulkWriteOptions,
|
|
364
|
-
dbOptions?: DbOptions
|
|
365
|
-
): Promise<OrderedBulkOperation | UnorderedBulkOperation>;
|
|
366
|
-
}
|
|
367
|
-
|
|
1
|
+
import type {
|
|
2
|
+
Document,
|
|
3
|
+
InsertOneOptions,
|
|
4
|
+
InsertOneResult,
|
|
5
|
+
Collection,
|
|
6
|
+
RenameOptions,
|
|
7
|
+
FindOneAndDeleteOptions,
|
|
8
|
+
FindOneAndReplaceOptions,
|
|
9
|
+
FindOneAndUpdateOptions,
|
|
10
|
+
BulkWriteOptions,
|
|
11
|
+
AnyBulkWriteOperation,
|
|
12
|
+
DeleteOptions,
|
|
13
|
+
DeleteResult,
|
|
14
|
+
InsertManyResult,
|
|
15
|
+
ReplaceOptions,
|
|
16
|
+
UpdateResult,
|
|
17
|
+
UpdateOptions,
|
|
18
|
+
DropDatabaseOptions,
|
|
19
|
+
CreateIndexesOptions,
|
|
20
|
+
DropCollectionOptions,
|
|
21
|
+
BulkWriteResult,
|
|
22
|
+
RunCommandOptions,
|
|
23
|
+
DbOptions,
|
|
24
|
+
OrderedBulkOperation,
|
|
25
|
+
UnorderedBulkOperation
|
|
26
|
+
} from './all-transport-types';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Interface for write operations in the CRUD specification.
|
|
30
|
+
*/
|
|
31
|
+
export default interface Writable {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {String} db - the db name
|
|
35
|
+
* @param spec
|
|
36
|
+
* @param options
|
|
37
|
+
* @param {DbOptions} dbOptions - The database options
|
|
38
|
+
* @return {Promise<Document>}
|
|
39
|
+
*/
|
|
40
|
+
runCommand(
|
|
41
|
+
db: string,
|
|
42
|
+
spec: Document,
|
|
43
|
+
options: RunCommandOptions,
|
|
44
|
+
dbOptions?: DbOptions
|
|
45
|
+
): Promise<Document>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {String} db - the db name
|
|
49
|
+
* @param spec
|
|
50
|
+
* @param options
|
|
51
|
+
* @param {DbOptions} dbOptions - The database options
|
|
52
|
+
* @return {Promise<Document>}
|
|
53
|
+
*/
|
|
54
|
+
runCommandWithCheck(
|
|
55
|
+
db: string,
|
|
56
|
+
spec: Document,
|
|
57
|
+
options: RunCommandOptions,
|
|
58
|
+
dbOptions?: DbOptions
|
|
59
|
+
): Promise<Document>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Drop a database
|
|
63
|
+
*
|
|
64
|
+
* @param {String} database - The database name.
|
|
65
|
+
* @param {Document} options - The options.
|
|
66
|
+
* @param {DbOptions} dbOptions - The database options
|
|
67
|
+
*
|
|
68
|
+
* @returns {Promise<Document>} The result of the operation.
|
|
69
|
+
*/
|
|
70
|
+
dropDatabase(
|
|
71
|
+
database: string,
|
|
72
|
+
options: DropDatabaseOptions,
|
|
73
|
+
dbOptions?: DbOptions
|
|
74
|
+
): Promise<Document>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Execute a mix of write operations.
|
|
78
|
+
*
|
|
79
|
+
* @param {String} database - The database name.
|
|
80
|
+
* @param {String} collection - The collection name.
|
|
81
|
+
* @param {Document} requests - The bulk write requests.
|
|
82
|
+
* @param {Document} options - The bulk write options.
|
|
83
|
+
* @param {DbOptions} dbOptions - The database options
|
|
84
|
+
*
|
|
85
|
+
* @returns {Promise} The promise of the result.
|
|
86
|
+
*/
|
|
87
|
+
bulkWrite(
|
|
88
|
+
database: string,
|
|
89
|
+
collection: string,
|
|
90
|
+
requests: AnyBulkWriteOperation[],
|
|
91
|
+
options: BulkWriteOptions,
|
|
92
|
+
dbOptions?: DbOptions): Promise<BulkWriteResult>;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Delete multiple documents from the collection.
|
|
96
|
+
*
|
|
97
|
+
* @param {String} database - The database name.
|
|
98
|
+
* @param {String} collection - The collection name.
|
|
99
|
+
* @param {Document} filter - The filter.
|
|
100
|
+
* @param {Document} options - The delete many options.
|
|
101
|
+
* @param {DbOptions} dbOptions - The database options
|
|
102
|
+
*
|
|
103
|
+
* @returns {Promise} The promise of the result.
|
|
104
|
+
*/
|
|
105
|
+
deleteMany(
|
|
106
|
+
database: string,
|
|
107
|
+
collection: string,
|
|
108
|
+
filter: Document,
|
|
109
|
+
options: DeleteOptions,
|
|
110
|
+
dbOptions?: DbOptions): Promise<DeleteResult>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Delete one document from the collection.
|
|
114
|
+
*
|
|
115
|
+
* @param {String} database - The database name.
|
|
116
|
+
* @param {String} collection - The collection name.
|
|
117
|
+
* @param {Document} filter - The filter.
|
|
118
|
+
* @param {Document} options - The delete one options.
|
|
119
|
+
* @param {DbOptions} dbOptions - The database options
|
|
120
|
+
*
|
|
121
|
+
* @returns {Promise} The promise of the result.
|
|
122
|
+
*/
|
|
123
|
+
deleteOne(
|
|
124
|
+
database: string,
|
|
125
|
+
collection: string,
|
|
126
|
+
filter: Document,
|
|
127
|
+
options: DeleteOptions,
|
|
128
|
+
dbOptions?: DbOptions): Promise<DeleteResult>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Find one document and delete it.
|
|
132
|
+
*
|
|
133
|
+
* @param {String} database - The database name.
|
|
134
|
+
* @param {String} collection - The collection name.
|
|
135
|
+
* @param {Document} filter - The filter.
|
|
136
|
+
* @param {Document} options - The find options.
|
|
137
|
+
* @param {DbOptions} dbOptions - The database options
|
|
138
|
+
*
|
|
139
|
+
* @returns {Promise} The promise of the result.
|
|
140
|
+
*/
|
|
141
|
+
findOneAndDelete(
|
|
142
|
+
database: string,
|
|
143
|
+
collection: string,
|
|
144
|
+
filter: Document,
|
|
145
|
+
options: FindOneAndDeleteOptions,
|
|
146
|
+
dbOptions?: DbOptions): Promise<Document>;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Find one document and replace it.
|
|
150
|
+
*
|
|
151
|
+
* @param {String} database - The database name.
|
|
152
|
+
* @param {String} collection - The collection name.
|
|
153
|
+
* @param {Document} filter - The filter.
|
|
154
|
+
* @param {Document} replacement - The replacement.
|
|
155
|
+
* @param {Document} options - The find options.
|
|
156
|
+
* @param {DbOptions} dbOptions - The database options
|
|
157
|
+
*
|
|
158
|
+
* @returns {Promise} The promise of the result.
|
|
159
|
+
*/
|
|
160
|
+
findOneAndReplace(
|
|
161
|
+
database: string,
|
|
162
|
+
collection: string,
|
|
163
|
+
filter: Document,
|
|
164
|
+
replacement: Document,
|
|
165
|
+
options: FindOneAndReplaceOptions,
|
|
166
|
+
dbOptions?: DbOptions): Promise<Document>;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Find one document and update it.
|
|
170
|
+
*
|
|
171
|
+
* @param {String} database - The database name.
|
|
172
|
+
* @param {String} collection - The collection name.
|
|
173
|
+
* @param {Document} filter - The filter.
|
|
174
|
+
* @param {(Document|Array)} update - The update.
|
|
175
|
+
* @param {Document} options - The find options.
|
|
176
|
+
* @param {DbOptions} dbOptions - The DB options
|
|
177
|
+
*
|
|
178
|
+
* @returns {Promise} The promise of the result.
|
|
179
|
+
*/
|
|
180
|
+
findOneAndUpdate(
|
|
181
|
+
database: string,
|
|
182
|
+
collection: string,
|
|
183
|
+
filter: Document,
|
|
184
|
+
update: Document | Document[],
|
|
185
|
+
options: FindOneAndUpdateOptions,
|
|
186
|
+
dbOptions?: DbOptions): Promise<Document>;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Insert many documents into the colleciton.
|
|
190
|
+
*
|
|
191
|
+
* @param {String} database - The database name.
|
|
192
|
+
* @param {String} collection - The collection name.
|
|
193
|
+
* @param {Array} docs - The documents.
|
|
194
|
+
* @param {Document} options - The insert many options.
|
|
195
|
+
* @param {DbOptions} dbOptions - The DB options
|
|
196
|
+
*
|
|
197
|
+
* @returns {Promise} The promise of the result.
|
|
198
|
+
*/
|
|
199
|
+
insertMany(
|
|
200
|
+
database: string,
|
|
201
|
+
collection: string,
|
|
202
|
+
docs: Document[],
|
|
203
|
+
options: BulkWriteOptions,
|
|
204
|
+
dbOptions?: DbOptions): Promise<InsertManyResult>;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Insert one document into the collection.
|
|
208
|
+
*
|
|
209
|
+
* @param {String} database - The database name.
|
|
210
|
+
* @param {String} collection - The collection name.
|
|
211
|
+
* @param {Document} doc - The document.
|
|
212
|
+
* @param {Document} options - The insert one options.
|
|
213
|
+
* @param {DbOptions} dbOptions - The DB options
|
|
214
|
+
*
|
|
215
|
+
* @returns {Promise} The promise of the result.
|
|
216
|
+
*/
|
|
217
|
+
insertOne(
|
|
218
|
+
database: string,
|
|
219
|
+
collection: string,
|
|
220
|
+
doc: Document,
|
|
221
|
+
options: InsertOneOptions,
|
|
222
|
+
dbOptions?: DbOptions): Promise<InsertOneResult>;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Replace a document with another.
|
|
226
|
+
*
|
|
227
|
+
* @param {String} database - The database name.
|
|
228
|
+
* @param {String} collection - The collection name.
|
|
229
|
+
* @param {Document} filter - The filter.
|
|
230
|
+
* @param {Document} replacement - The replacement document for matches.
|
|
231
|
+
* @param {Document} options - The replace options.
|
|
232
|
+
* @param {DbOptions} dbOptions - The DB options
|
|
233
|
+
*
|
|
234
|
+
* @returns {Promise} The promise of the result.
|
|
235
|
+
*/
|
|
236
|
+
replaceOne(
|
|
237
|
+
database: string,
|
|
238
|
+
collection: string,
|
|
239
|
+
filter: Document,
|
|
240
|
+
replacement: Document,
|
|
241
|
+
options?: ReplaceOptions,
|
|
242
|
+
dbOptions?: DbOptions): Promise<UpdateResult>;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Update many document.
|
|
246
|
+
*
|
|
247
|
+
* @param {String} database - The database name.
|
|
248
|
+
* @param {String} collection - The collection name.
|
|
249
|
+
* @param {Document} filter - The filter.
|
|
250
|
+
* @param {(Document|Array)} update - The updates.
|
|
251
|
+
* @param {Document} options - The update options.
|
|
252
|
+
* @param {DbOptions} dbOptions - The DB options
|
|
253
|
+
*
|
|
254
|
+
* @returns {Promise} The promise of the result.
|
|
255
|
+
*/
|
|
256
|
+
updateMany(
|
|
257
|
+
database: string,
|
|
258
|
+
collection: string,
|
|
259
|
+
filter: Document,
|
|
260
|
+
update: Document,
|
|
261
|
+
options?: UpdateOptions,
|
|
262
|
+
dbOptions?: DbOptions): Promise<UpdateResult>;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Update a document.
|
|
266
|
+
*
|
|
267
|
+
* @param {String} database - The database name.
|
|
268
|
+
* @param {String} collection - The collection name.
|
|
269
|
+
* @param {Document} filter - The filter.
|
|
270
|
+
* @param {(Document|Array)} update - The updates.
|
|
271
|
+
* @param {Document} options - The update options.
|
|
272
|
+
* @param {DbOptions} dbOptions - The DB options
|
|
273
|
+
*
|
|
274
|
+
* @returns {Promise} The promise of the result.
|
|
275
|
+
*/
|
|
276
|
+
updateOne(
|
|
277
|
+
database: string,
|
|
278
|
+
collection: string,
|
|
279
|
+
filter: Document,
|
|
280
|
+
update: Document,
|
|
281
|
+
options?: UpdateOptions,
|
|
282
|
+
dbOptions?: DbOptions): Promise<UpdateResult>;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Deprecated remove command.
|
|
286
|
+
*
|
|
287
|
+
* @param {String} database - The db name.
|
|
288
|
+
* @param {String} collection - The collection name.
|
|
289
|
+
* @param {Object} query - The query.
|
|
290
|
+
* @param {Object} options - The options.
|
|
291
|
+
* @param {DbOptions} dbOptions - The database options
|
|
292
|
+
*
|
|
293
|
+
* @return {Promise}
|
|
294
|
+
*/
|
|
295
|
+
remove(
|
|
296
|
+
database: string,
|
|
297
|
+
collection: string,
|
|
298
|
+
query: Document,
|
|
299
|
+
options?: DeleteOptions,
|
|
300
|
+
dbOptions?: DbOptions): Promise<DeleteResult>;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Adds new indexes to a collection.
|
|
304
|
+
*
|
|
305
|
+
* @param {String} database - The db name.
|
|
306
|
+
* @param {String} collection - The collection name.
|
|
307
|
+
* @param {Object[]} indexSpecs the spec of the indexes to be created.
|
|
308
|
+
* @param {Object} options - The command options.
|
|
309
|
+
* @param {DbOptions} dbOptions - The database options
|
|
310
|
+
* @return {Promise}
|
|
311
|
+
*/
|
|
312
|
+
createIndexes(
|
|
313
|
+
database: string,
|
|
314
|
+
collection: string,
|
|
315
|
+
indexSpecs: Document[],
|
|
316
|
+
options?: CreateIndexesOptions,
|
|
317
|
+
dbOptions?: DbOptions): Promise<string[]>;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Drops a collection.
|
|
321
|
+
*
|
|
322
|
+
* @param {String} database - The db name.
|
|
323
|
+
* @param {String} collection - The collection name.
|
|
324
|
+
* @param options
|
|
325
|
+
* @param {DbOptions} dbOptions - The database options
|
|
326
|
+
*
|
|
327
|
+
* @return {Promise}
|
|
328
|
+
*/
|
|
329
|
+
dropCollection(
|
|
330
|
+
database: string,
|
|
331
|
+
collection: string,
|
|
332
|
+
options: DropCollectionOptions,
|
|
333
|
+
dbOptions?: DbOptions
|
|
334
|
+
): Promise<boolean>;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @param {String} database - The db name.
|
|
338
|
+
* @param {String} oldName - The collection name.
|
|
339
|
+
* @param {String} newName - The new collection name.
|
|
340
|
+
* @param {String} options - The options.
|
|
341
|
+
* @param {DbOptions} dbOptions - The database options
|
|
342
|
+
*/
|
|
343
|
+
renameCollection(
|
|
344
|
+
database: string,
|
|
345
|
+
oldName: string,
|
|
346
|
+
newName: string,
|
|
347
|
+
options?: RenameOptions,
|
|
348
|
+
dbOptions?: DbOptions): Promise<Collection>;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Initialize a bulk operation.
|
|
352
|
+
*
|
|
353
|
+
* @param dbName
|
|
354
|
+
* @param collName
|
|
355
|
+
* @param ordered
|
|
356
|
+
* @param options
|
|
357
|
+
* @param dbOptions
|
|
358
|
+
*/
|
|
359
|
+
initializeBulkOp(
|
|
360
|
+
dbName: string,
|
|
361
|
+
collName: string,
|
|
362
|
+
ordered: boolean,
|
|
363
|
+
options?: BulkWriteOptions,
|
|
364
|
+
dbOptions?: DbOptions
|
|
365
|
+
): Promise<OrderedBulkOperation | UnorderedBulkOperation>;
|
|
366
|
+
}
|
|
367
|
+
|