Skip to content

Commit

Permalink
quering for range can be done as a single document, otherwise shows e…
Browse files Browse the repository at this point in the history
…rror too
  • Loading branch information
NickOvt committed Oct 15, 2024
1 parent 37374be commit 35859fb
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions lib/handlers/on-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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
};
Expand All @@ -279,7 +271,7 @@ module.exports = server => (mailbox, options, session, callback) => {
hdate: !ne
? entry
: {
$not: entry
$not: {}
}
};

Expand Down

0 comments on commit 35859fb

Please sign in to comment.