I'm working on a query which will filter documents with nodes that are empty JSON arrays like this (Output property):
{
"Id": "0aec6b50-03ff-48c9-ac35-1b5e7640a892",
"Input": "00000000-0000-0000-0000-000000000000",
"Output": [
]
}
for now I'm using this query:
cts.orQuery([
cts.notQuery(cts.jsonPropertyValueQuery('Input','00000000-0000-0000-0000-000000000000')),
cts.jsonPropertyValueQuery('Output', '*', 'wildcarded')
])
It is filtering all documents with empty (empty GUID) Input
field and should (but isn't) filter documents with empty (empty array) Output
.
It is working with document:
{
"Id": "0aec6b50-03ff-48c9-ac35-1b5e7640a892",
"Input": "00000000-0000-0000-0000-000000000000",
"Output": ""
}
I assume that it is because empty array is for MarkLogic a value. Has anyone had similar issue? How to query for empty JSON array?
EDIT:
non-empty message (which should be returned) looks like this:
{
"Id": "0aec6b50-03ff-48c9-ac35-1b5e7640a892",
"Input": "00000000-0000-0000-0000-000000000000",
"Output": [
"91ad81fe-9c82-4090-b6a9-a918f901de46"
]
}