Fix ne search (#6330)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-08-14 12:33:22 +05:00 committed by GitHub
parent 8ac67565b7
commit 5059e067da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -290,9 +290,7 @@ function getResultIds (ids: Set<Ref<Doc>>, _id: ObjQueryType<Ref<Doc>> | undefin
const result = new Set<Ref<Doc>>()
if (_id !== undefined) {
if (typeof _id === 'string') {
if (!ids.has(_id)) {
return new Set()
} else {
if (ids.has(_id)) {
result.add(_id)
}
} else if (_id.$in !== undefined) {
@ -302,11 +300,13 @@ function getResultIds (ids: Set<Ref<Doc>>, _id: ObjQueryType<Ref<Doc>> | undefin
}
}
} else if (_id.$nin !== undefined) {
for (const id of ids) {
if (!_id.$nin.includes(id)) {
result.add(id)
}
for (const id of _id.$nin) {
ids.delete(id)
}
return ids
} else if (_id.$ne !== undefined) {
ids.delete(_id.$ne)
return ids
}
} else {
return ids