From 3804bea81eba2e2e865e49f268d072daab630901 Mon Sep 17 00:00:00 2001 From: NickOvt Date: Mon, 28 Oct 2024 08:46:03 +0200 Subject: [PATCH] fix: quering for range ZMS-182 (#742) * quering for range can be done as a single document, otherwise shows error too * fix buggy typo introduced in last commit --- lib/handlers/on-search.js | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/lib/handlers/on-search.js b/lib/handlers/on-search.js index 1a97422a..c889de41 100644 --- a/lib/handlers/on-search.js +++ b/lib/handlers/on-search.js @@ -220,14 +220,10 @@ module.exports = server => (mailbox, options, session, callback) => { break; } let entry = !op - ? [ - { - $gte: value - }, - { - $lt: new Date(value.getTime() + 24 * 3600 * 1000) - } - ] + ? { + $gte: value, + $lt: new Date(value.getTime() + 24 * 3600 * 1000) + } : { [op]: value }; @@ -263,14 +259,10 @@ module.exports = server => (mailbox, options, session, callback) => { break; } let entry = !op - ? [ - { - $gte: value - }, - { - $lt: new Date(value.getTime() + 24 * 3600 * 1000) - } - ] + ? { + $gte: value, + $lt: new Date(value.getTime() + 24 * 3600 * 1000) + } : { [op]: value };