Skip to content

Commit e9e9c75

Browse files
fix: check for 'undefined' in place of a falsy value
1 parent dfcf905 commit e9e9c75

File tree

7 files changed

+14
-7
lines changed

7 files changed

+14
-7
lines changed

src/cmap/connection.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,8 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
583583
getMoreCmd.maxTimeMS = options.maxAwaitTimeMS;
584584
}
585585

586-
if (options.comment) {
586+
// eslint-disable-next-line no-restricted-syntax
587+
if (options.comment !== undefined) {
587588
getMoreCmd.comment = options.comment;
588589
}
589590

src/cursor/abstract_cursor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ export abstract class AbstractCursor<
170170
this[kOptions].batchSize = options.batchSize;
171171
}
172172

173-
if (options.comment != null) {
173+
// eslint-disable-next-line no-restricted-syntax
174+
if (options.comment !== undefined) {
174175
this[kOptions].comment = options.comment;
175176
}
176177

src/operations/aggregate.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ export class AggregateOperation<T = Document> extends CommandOperation<T> {
131131
command.let = options.let;
132132
}
133133

134-
if (options.comment) {
134+
// eslint-disable-next-line no-restricted-syntax
135+
if (options.comment !== undefined) {
135136
command.comment = options.comment;
136137
}
137138

src/operations/delete.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ export class DeleteOperation extends CommandOperation<Document> {
9494
command.let = options.let;
9595
}
9696

97-
if (options.comment) {
97+
// eslint-disable-next-line no-restricted-syntax
98+
if (options.comment !== undefined) {
9899
command.comment = options.comment;
99100
}
100101

src/operations/find.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ function makeFindCommand(ns: MongoDBNamespace, filter: Document, options: FindOp
248248
findCommand.singleBatch = options.singleBatch;
249249
}
250250

251-
if (options.comment) {
251+
// eslint-disable-next-line no-restricted-syntax
252+
if (options.comment !== undefined) {
252253
findCommand.comment = options.comment;
253254
}
254255

src/operations/find_and_modify.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ class FindAndModifyOperation extends CommandOperation<Document> {
149149
this.cmdBase.let = options.let;
150150
}
151151

152-
if (options.comment) {
152+
// eslint-disable-next-line no-restricted-syntax
153+
if (options.comment !== undefined) {
153154
this.cmdBase.comment = options.comment;
154155
}
155156

src/operations/update.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ export class UpdateOperation extends CommandOperation<Document> {
107107
command.let = options.let;
108108
}
109109

110-
if (options.comment) {
110+
// eslint-disable-next-line no-restricted-syntax
111+
if (options.comment !== undefined) {
111112
command.comment = options.comment;
112113
}
113114

0 commit comments

Comments
 (0)