From 58f384dbf04cc9df23e19113094b836ffa6438c7 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Wed, 7 Aug 2024 20:05:53 -0400 Subject: [PATCH] fix(query): consistent handling for non-object options with countDocuments(), estimatedDocumentCount(), distinct() --- lib/query.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/query.js b/lib/query.js index 20532ad1f8f..fa5d2cd856e 100644 --- a/lib/query.js +++ b/lib/query.js @@ -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); } @@ -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); } @@ -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); }