Skip to content

Commit 43ba9fc

Browse files
authored
fix(NODE-4129): constrain watch type parameter to extend ChangeStream type parameter (#3183)
1 parent 5132bc9 commit 43ba9fc

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/collection.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,7 @@ export class Collection<TSchema extends Document = Document> {
14221422
* @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.
14231423
* @param options - Optional settings for the command
14241424
*/
1425-
watch<TLocal = TSchema>(
1425+
watch<TLocal extends Document = TSchema>(
14261426
pipeline: Document[] = [],
14271427
options: ChangeStreamOptions = {}
14281428
): ChangeStream<TLocal> {

src/db.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ export class Db {
722722
* @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.
723723
* @param options - Optional settings for the command
724724
*/
725-
watch<TSchema = Document>(
725+
watch<TSchema extends Document = Document>(
726726
pipeline: Document[] = [],
727727
options: ChangeStreamOptions = {}
728728
): ChangeStream<TSchema> {

src/mongo_client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
590590
* @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.
591591
* @param options - Optional settings for the command
592592
*/
593-
watch<TSchema = Document>(
593+
watch<TSchema extends Document = Document>(
594594
pipeline: Document[] = [],
595595
options: ChangeStreamOptions = {}
596596
): ChangeStream<TSchema> {

0 commit comments

Comments
 (0)