Hi @vsr1 ,
I have the below nested structure from which I need to read data.
metadata{
“type”: “documentType”,
“description”: “”,
“id”: “id”,
“tag”: {
“value1”: “value1”,
“value2”: “value2”
}
}
User can request with multiple things and those can be dynamic
like
$1 can have below values
{“type”:“documentType”}
or
{“type”:“documentType”:“id”:“id”}
Sample Query written for the same
SELECT d.metadata.*,
FROM bucket
AS d
WHERE ANY
AND EVERY f IN OBJECT_PAIRS($1) SATISFIES d.metadata.[f.name] = f.val END
Everything works fine if I am passing values that aren’t nested under metadata.
It even works for value when I pass $1 = “tag”: {
“value1”: “value1”,
“value2”: “value2”
}
which means under tag I have to pass both values.
but when I pass $1 = { “tag”: {
“value2”: “value2”
}}
it returns back empty result.
I want like under metadata whatever is passed it should match , similar lily for
nested elements if one value is passed and that matches , it should return back the result .Currently it is expecting all the elements to be passed in nested json to get a match.
Sample Query which is not giving out result
SELECT d.metadata.*,
FROM bucket
AS d
WHERE ANY
AND EVERY f IN OBJECT_PAIRS({“tag”:{“value1”:“value1”}}) SATISFIES d.metadata.[f.name] = f.val END