diff --git a/src/collection.ts b/src/collection.ts index 6a8d0305ad..efd5d8db66 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -1398,9 +1398,6 @@ export class Collection { pipeline: Document[] = [], options: ChangeStreamOptions = {} ): ChangeStream { - pipeline = pipeline ?? []; - options = options ?? {}; - // Allow optionally not specifying a pipeline if (!Array.isArray(pipeline)) { options = pipeline; diff --git a/src/db.ts b/src/db.ts index 4410e87480..e343047e61 100644 --- a/src/db.ts +++ b/src/db.ts @@ -714,15 +714,10 @@ export class Db { * @param pipeline - An array of {@link https://docs.mongodb.com/manual/reference/operator/aggregation-pipeline/|aggregation pipeline stages} through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents. * @param options - Optional settings for the command */ - watch(): ChangeStream; - watch(pipeline?: Document[]): ChangeStream; watch( - pipeline?: Document[], - options?: ChangeStreamOptions + pipeline: Document[] = [], + options: ChangeStreamOptions = {} ): ChangeStream { - pipeline = pipeline ?? []; - options = options ?? {}; - // Allow optionally not specifying a pipeline if (!Array.isArray(pipeline)) { options = pipeline; diff --git a/src/mongo_client.ts b/src/mongo_client.ts index 34ec5b56ed..4053584c62 100644 --- a/src/mongo_client.ts +++ b/src/mongo_client.ts @@ -596,15 +596,10 @@ export class MongoClient extends TypedEventEmitter { * @param pipeline - An array of {@link https://docs.mongodb.com/manual/reference/operator/aggregation-pipeline/|aggregation pipeline stages} through which to pass change stream documents. This allows for filtering (using $match) and manipulating the change stream documents. * @param options - Optional settings for the command */ - watch(): ChangeStream; - watch(pipeline?: Document[]): ChangeStream; watch( pipeline: Document[] = [], options: ChangeStreamOptions = {} ): ChangeStream { - pipeline = pipeline ?? []; - options = options ?? {}; - // Allow optionally not specifying a pipeline if (!Array.isArray(pipeline)) { options = pipeline;