Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/change_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ export class ChangeStream<

/** Close the Change Stream */
close(): Promise<void>;
/** @deprecated Callbacks are deprecated and will be removed in the next major version */
close(callback: Callback): void;
close(callback?: Callback): Promise<void> | void {
this[kClosed] = true;
Expand Down
9 changes: 8 additions & 1 deletion src/cursor/abstract_cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export abstract class AbstractCursor<
}

hasNext(): Promise<boolean>;
/** @deprecated Callbacks are deprecated and will be removed in the next major version */
hasNext(callback: Callback<boolean>): void;
hasNext(callback?: Callback<boolean>): Promise<boolean> | void {
return maybePromise(callback, done => {
Expand Down Expand Up @@ -344,7 +345,9 @@ export abstract class AbstractCursor<

/** Get the next available document from the cursor, returns null if no more documents are available. */
next(): Promise<TSchema | null>;
/** @deprecated Callbacks are deprecated and will be removed in the next major version */
next(callback: Callback<TSchema | null>): void;
/** @deprecated Callbacks are deprecated and will be removed in the next major version */
next(callback?: Callback<TSchema | null>): Promise<TSchema | null> | void;
next(callback?: Callback<TSchema | null>): Promise<TSchema | null> | void {
return maybePromise(callback, done => {
Expand All @@ -360,6 +363,7 @@ export abstract class AbstractCursor<
* Try to get the next available document from the cursor or `null` if an empty batch is returned
*/
tryNext(): Promise<TSchema | null>;
/** @deprecated Callbacks are deprecated and will be removed in the next major version */
tryNext(callback: Callback<TSchema | null>): void;
tryNext(callback?: Callback<TSchema | null>): Promise<TSchema | null> | void {
return maybePromise(callback, done => {
Expand All @@ -378,6 +382,7 @@ export abstract class AbstractCursor<
* @param callback - The end callback.
*/
forEach(iterator: (doc: TSchema) => boolean | void): Promise<void>;
/** @deprecated Callbacks are deprecated and will be removed in the next major version */
forEach(iterator: (doc: TSchema) => boolean | void, callback: Callback<void>): void;
forEach(
iterator: (doc: TSchema) => boolean | void,
Expand Down Expand Up @@ -423,13 +428,14 @@ export abstract class AbstractCursor<
}

close(): Promise<void>;
/** @deprecated Callbacks are deprecated and will be removed in the next major version */
close(callback: Callback): void;
/**
* @deprecated options argument is deprecated
*/
close(options: CursorCloseOptions): Promise<void>;
/**
* @deprecated options argument is deprecated
* @deprecated options argument is deprecated. Callbacks are deprecated and will be removed in the next major version
*/
close(options: CursorCloseOptions, callback: Callback): void;
close(options?: CursorCloseOptions | Callback, callback?: Callback): Promise<void> | void {
Expand All @@ -451,6 +457,7 @@ export abstract class AbstractCursor<
* @param callback - The result callback.
*/
toArray(): Promise<TSchema[]>;
/** @deprecated Callbacks are deprecated and will be removed in the next major version */
toArray(callback: Callback<TSchema[]>): void;
toArray(callback?: Callback<TSchema[]>): Promise<TSchema[]> | void {
return maybePromise(callback, done => {
Expand Down
1 change: 1 addition & 0 deletions src/cursor/aggregation_cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export class AggregationCursor<TSchema = any> extends AbstractCursor<TSchema> {

/** Execute the explain for the cursor */
explain(): Promise<Document>;
/** @deprecated Callbacks are deprecated and will be removed in the next major version */
explain(callback: Callback): void;
explain(verbosity: ExplainVerbosityLike): Promise<Document>;
explain(
Expand Down
7 changes: 4 additions & 3 deletions src/cursor/find_cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ export class FindCursor<TSchema = any> extends AbstractCursor<TSchema> {
* @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead
*/
count(): Promise<number>;
/** @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead */
/** @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead. Callbacks are deprecated and will be removed in the next major version */
count(callback: Callback<number>): void;
/** @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead */
/** @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead. */
count(options: CountOptions): Promise<number>;
/** @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead */
/** @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead. Callbacks are deprecated and will be removed in the next major version */
count(options: CountOptions, callback: Callback<number>): void;
count(
options?: CountOptions | Callback<number>,
Expand Down Expand Up @@ -155,6 +155,7 @@ export class FindCursor<TSchema = any> extends AbstractCursor<TSchema> {

/** Execute the explain for the cursor */
explain(): Promise<Document>;
/** @deprecated Callbacks are deprecated and will be removed in the next major version */
explain(callback: Callback): void;
explain(verbosity?: ExplainVerbosityLike): Promise<Document>;
explain(
Expand Down