You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* const client = new MongoClient('mongodb://localhost:27017');
36
+
* const admin = client.db().admin();
37
+
* const dbInfo = await admin.listDatabases();
38
+
* for (const db of dbInfo.databases) {
39
+
* console.log(db.name);
40
+
* }
52
41
* ```
53
42
*/
54
43
exportclassAdmin{
@@ -71,8 +60,10 @@ export class Admin {
71
60
* @param callback - An optional callback, a Promise will be returned if none is provided
72
61
*/
73
62
command(command: Document): Promise<Document>;
63
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @param callback - An optional callback, a Promise will be returned if none is provided
97
88
*/
98
89
buildInfo(): Promise<Document>;
90
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @param callback - An optional callback, a Promise will be returned if none is provided
116
109
*/
117
110
serverInfo(): Promise<Document>;
111
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @param callback - An optional callback, a Promise will be returned if none is provided
135
130
*/
136
131
serverStatus(): Promise<Document>;
132
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @param callback - An optional callback, a Promise will be returned if none is provided
154
151
*/
155
152
ping(): Promise<Document>;
153
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @param callback - An optional callback, a Promise will be returned if none is provided
175
174
*/
176
175
addUser(username: string): Promise<Document>;
176
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
183
186
addUser(
184
187
username: string,
185
188
password: string,
@@ -221,8 +224,10 @@ export class Admin {
221
224
* @param callback - An optional callback, a Promise will be returned if none is provided
222
225
*/
223
226
removeUser(username: string): Promise<boolean>;
227
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
252
259
validateCollection(
253
260
collectionName: string,
254
261
options: ValidateCollectionOptions,
@@ -276,8 +283,10 @@ export class Admin {
276
283
* @param callback - An optional callback, a Promise will be returned if none is provided
277
284
*/
278
285
listDatabases(): Promise<ListDatabasesResult>;
286
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @param callback - An optional callback, a Promise will be returned if none is provided
301
310
*/
302
311
replSetGetStatus(): Promise<Document>;
312
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
Copy file name to clipboardexpand all lines: src/change_stream.ts
+4
Original file line number
Diff line number
Diff line change
@@ -645,6 +645,7 @@ export class ChangeStream<
645
645
646
646
/** Check if there is any document still available in the Change Stream */
647
647
hasNext(): Promise<boolean>;
648
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** Get the next available document from the Change Stream. */
677
678
next(): Promise<TChange>;
679
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* Try to get the next available document from the Change Stream's cursor or `null` if an empty batch is returned
710
712
*/
711
713
tryNext(): Promise<Document|null>;
714
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
Copy file name to clipboardexpand all lines: src/cursor/abstract_cursor.ts
+8-1
Original file line number
Diff line number
Diff line change
@@ -317,6 +317,7 @@ export abstract class AbstractCursor<
317
317
}
318
318
319
319
hasNext(): Promise<boolean>;
320
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
@@ -344,7 +345,9 @@ export abstract class AbstractCursor<
344
345
345
346
/** Get the next available document from the cursor, returns null if no more documents are available. */
346
347
next(): Promise<TSchema|null>;
348
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
347
349
next(callback: Callback<TSchema|null>): void;
350
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
@@ -360,6 +363,7 @@ export abstract class AbstractCursor<
360
363
* Try to get the next available document from the cursor or `null` if an empty batch is returned
361
364
*/
362
365
tryNext(): Promise<TSchema|null>;
366
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
@@ -423,13 +428,14 @@ export abstract class AbstractCursor<
423
428
}
424
429
425
430
close(): Promise<void>;
431
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @deprecated options argument is deprecated. Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance
@@ -451,6 +457,7 @@ export abstract class AbstractCursor<
451
457
* @param callback - The result callback.
452
458
*/
453
459
toArray(): Promise<TSchema[]>;
460
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead
123
123
*/
124
124
count(): Promise<number>;
125
-
/** @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead */
125
+
/** @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead. Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
126
126
count(callback: Callback<number>): void;
127
-
/** @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead */
127
+
/** @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead. */
128
128
count(options: CountOptions): Promise<number>;
129
-
/** @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead */
129
+
/** @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead. Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @param callback - An optional callback, a Promise will be returned if none is provided
273
278
*/
274
279
command(command: Document): Promise<Document>;
280
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @param callback - An optional callback, a Promise will be returned if none is provided
348
355
*/
349
356
stats(): Promise<Document>;
357
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @param callback - An optional callback, a Promise will be returned if none is provided
454
465
*/
455
466
dropCollection(name: string): Promise<boolean>;
467
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @param callback - An optional callback, a Promise will be returned if none is provided
478
491
*/
479
492
dropDatabase(): Promise<boolean>;
493
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @param callback - An optional callback, a Promise will be returned if none is provided
501
516
*/
502
517
collections(): Promise<Collection[]>;
518
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
534
553
createIndex(
535
554
name: string,
536
555
indexSpec: IndexSpecification,
@@ -561,12 +580,16 @@ export class Db {
561
580
* @param callback - An optional callback, a Promise will be returned if none is provided
562
581
*/
563
582
addUser(username: string): Promise<Document>;
583
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
570
593
addUser(
571
594
username: string,
572
595
password: string,
@@ -606,8 +629,10 @@ export class Db {
606
629
* @param callback - An optional callback, a Promise will be returned if none is provided
607
630
*/
608
631
removeUser(username: string): Promise<boolean>;
632
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
639
666
setProfilingLevel(
640
667
level: ProfilingLevel,
641
668
options: SetProfilingLevelOptions,
@@ -662,8 +689,10 @@ export class Db {
662
689
* @param callback - An optional callback, a Promise will be returned if none is provided
663
690
*/
664
691
profilingLevel(): Promise<string>;
692
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
Copy file name to clipboardexpand all lines: src/gridfs/index.ts
+3
Original file line number
Diff line number
Diff line change
@@ -141,6 +141,7 @@ export class GridFSBucket extends TypedEventEmitter<GridFSBucketEvents> {
141
141
* @param id - The id of the file doc
142
142
*/
143
143
delete(id: ObjectId): Promise<void>;
144
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
@@ -232,6 +234,7 @@ export class GridFSBucket extends TypedEventEmitter<GridFSBucketEvents> {
232
234
233
235
/** Removes this bucket's files collection, followed by its chunks collection. */
234
236
drop(): Promise<void>;
237
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
* @param callback - called when chunks are successfully removed or error occurred
147
147
*/
148
148
abort(): Promise<void>;
149
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
@@ -472,8 +452,10 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
472
452
* @param callback - An optional callback, a Promise will be returned if none is provided
473
453
*/
474
454
close(): Promise<void>;
455
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
475
456
close(callback: Callback<void>): void;
476
457
close(force: boolean): Promise<void>;
458
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
Copy file name to clipboardexpand all lines: src/sessions.ts
+4
Original file line number
Diff line number
Diff line change
@@ -245,8 +245,10 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
245
245
* @param callback - Optional callback for completion of this operation
246
246
*/
247
247
endSession(): Promise<void>;
248
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
@@ -433,6 +435,7 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
433
435
* @param callback - An optional callback, a Promise will be returned if none is provided
434
436
*/
435
437
commitTransaction(): Promise<Document>;
438
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
@@ -444,6 +447,7 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
444
447
* @param callback - An optional callback, a Promise will be returned if none is provided
445
448
*/
446
449
abortTransaction(): Promise<Document>;
450
+
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
0 commit comments