Skip to content

Commit

Permalink
fix(NODE-3430): watch method types on MongoClient and Db (#2900)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Jul 13, 2021
1 parent a3aa060 commit 17cc291
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
3 changes: 0 additions & 3 deletions src/collection.ts
Expand Up @@ -1398,9 +1398,6 @@ export class Collection<TSchema extends Document = Document> {
pipeline: Document[] = [],
options: ChangeStreamOptions = {}
): ChangeStream<TLocal> {
pipeline = pipeline ?? [];
options = options ?? {};

// Allow optionally not specifying a pipeline
if (!Array.isArray(pipeline)) {
options = pipeline;
Expand Down
9 changes: 2 additions & 7 deletions src/db.ts
Expand Up @@ -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<TSchema = Document>(): ChangeStream<TSchema>;
watch<TSchema = Document>(pipeline?: Document[]): ChangeStream<TSchema>;
watch<TSchema = Document>(
pipeline?: Document[],
options?: ChangeStreamOptions
pipeline: Document[] = [],
options: ChangeStreamOptions = {}
): ChangeStream<TSchema> {
pipeline = pipeline ?? [];
options = options ?? {};

// Allow optionally not specifying a pipeline
if (!Array.isArray(pipeline)) {
options = pipeline;
Expand Down
5 changes: 0 additions & 5 deletions src/mongo_client.ts
Expand Up @@ -596,15 +596,10 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
* @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<TSchema = Document>(): ChangeStream<TSchema>;
watch<TSchema = Document>(pipeline?: Document[]): ChangeStream<TSchema>;
watch<TSchema = Document>(
pipeline: Document[] = [],
options: ChangeStreamOptions = {}
): ChangeStream<TSchema> {
pipeline = pipeline ?? [];
options = options ?? {};

// Allow optionally not specifying a pipeline
if (!Array.isArray(pipeline)) {
options = pipeline;
Expand Down

0 comments on commit 17cc291

Please sign in to comment.