Skip to content

Commit 17cc291

Browse files
authored
fix(NODE-3430): watch method types on MongoClient and Db (#2900)
1 parent a3aa060 commit 17cc291

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

src/collection.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1398,9 +1398,6 @@ export class Collection<TSchema extends Document = Document> {
13981398
pipeline: Document[] = [],
13991399
options: ChangeStreamOptions = {}
14001400
): ChangeStream<TLocal> {
1401-
pipeline = pipeline ?? [];
1402-
options = options ?? {};
1403-
14041401
// Allow optionally not specifying a pipeline
14051402
if (!Array.isArray(pipeline)) {
14061403
options = pipeline;

src/db.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -714,15 +714,10 @@ export class Db {
714714
* @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.
715715
* @param options - Optional settings for the command
716716
*/
717-
watch<TSchema = Document>(): ChangeStream<TSchema>;
718-
watch<TSchema = Document>(pipeline?: Document[]): ChangeStream<TSchema>;
719717
watch<TSchema = Document>(
720-
pipeline?: Document[],
721-
options?: ChangeStreamOptions
718+
pipeline: Document[] = [],
719+
options: ChangeStreamOptions = {}
722720
): ChangeStream<TSchema> {
723-
pipeline = pipeline ?? [];
724-
options = options ?? {};
725-
726721
// Allow optionally not specifying a pipeline
727722
if (!Array.isArray(pipeline)) {
728723
options = pipeline;

src/mongo_client.ts

-5
Original file line numberDiff line numberDiff line change
@@ -596,15 +596,10 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
596596
* @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.
597597
* @param options - Optional settings for the command
598598
*/
599-
watch<TSchema = Document>(): ChangeStream<TSchema>;
600-
watch<TSchema = Document>(pipeline?: Document[]): ChangeStream<TSchema>;
601599
watch<TSchema = Document>(
602600
pipeline: Document[] = [],
603601
options: ChangeStreamOptions = {}
604602
): ChangeStream<TSchema> {
605-
pipeline = pipeline ?? [];
606-
options = options ?? {};
607-
608603
// Allow optionally not specifying a pipeline
609604
if (!Array.isArray(pipeline)) {
610605
options = pipeline;

0 commit comments

Comments
 (0)