Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(NODE-3430): watch method types on MongoClient and Db #2900

Merged
merged 1 commit into from Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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