From 17cc2918767acd41eaec8b602d82fc0a909e5950 Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Tue, 13 Jul 2021 13:19:10 -0400 Subject: [PATCH] fix(NODE-3430): watch method types on MongoClient and Db (#2900) --- src/collection.ts | 3 --- src/db.ts | 9 ++------- src/mongo_client.ts | 5 ----- 3 files changed, 2 insertions(+), 15 deletions(-) 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;