Skip to content

Commit

Permalink
fix(query): consistent handling for non-object options with countDocu…
Browse files Browse the repository at this point in the history
…ments(), estimatedDocumentCount(), distinct()
  • Loading branch information
vkarpov15 committed Aug 8, 2024
1 parent f6be45a commit 58f384d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -2773,7 +2773,7 @@ Query.prototype.estimatedDocumentCount = function(options) {
this.op = 'estimatedDocumentCount';
this._validateOp();

if (typeof options === 'object' && options != null) {
if (options != null) {
this.setOptions(options);
}

Expand Down Expand Up @@ -2832,7 +2832,7 @@ Query.prototype.countDocuments = function(conditions, options) {
this.merge(conditions);
}

if (typeof options === 'object' && options != null) {
if (options != null) {
this.setOptions(options);
}

Expand Down Expand Up @@ -2906,7 +2906,7 @@ Query.prototype.distinct = function(field, conditions, options) {
this._distinct = field;
}

if (typeof options === 'object' && options != null) {
if (options != null) {
this.setOptions(options);
}

Expand Down

0 comments on commit 58f384d

Please sign in to comment.