Hi,
i have a problem with a query , the query is
SELECT ARRAY dim.name FOR dim IN ARRAY_SORT(d) when dim.name in [‘NAME’,‘SURNAME’,‘ADDRESS’,‘city’,‘cap’] END AS titles,
ARRAY dim.value
FOR dim IN ARRAY_SORT(d) when dim.name in [‘NAME’,‘SURNAME’,‘ADDRESS’,‘city’,‘cap’] END as values
FROM test as f NEST test as d ON KEYS ARRAY dim FOR dim in f.properties END
WHERE f._class = ‘class’ AND f.name in [ ‘city’,‘cap’]
the documents that i use are in this format
{
“name”: “city”,
"_class": “class”,
“value”: “city1”,
“properties”: [
“4fc8c2d9-1c7a-4b41-bf94-26664e73950b”,
“a06b599e-0221-4ef3-9229-7703341b0299”,
“6ec33bf7-f687-499c-aefa-e05634b970dd”,
“16831c7d-9d9d-4188-a4df-a86496ae4949”
]
}
{
“name”: “cap”,
"_class": “class”,
“value”: “cap1”,
“properties”: [
“4fc8c2d9-1c7a-4b41-bf94-26664e73950b”,
“a06b599e-0221-4ef3-9229-7703341b0299”,
“6ec33bf7-f687-499c-aefa-e05634b970dd”,
“16831c7d-9d9d-4188-a4df-a86496ae4949”
]
}
the values on properties are the key for other documents with this format
{
“name”: “ADDRESS”,
“value”: “street example”
}
My queries return this
[
{
“titles”: [
“ADDRESS”,
“SURNAME”,
“cap”
],
“values”: [
“street example”,
“testSurname”,
“cap1”
]
},
{
“titles”: [
“ADDRESS”,
“NAME”,
“cap”
],
“values”: [
“street example”,
“test name”,
“cap1”
]
}
]
but i want a result of thi type
[
{
“titles”: [
“ADDRESS”,
“NAME”,
“SURNAME”,
“city”,
“cap”
],
“values”: [
“street example”,
null ,
“testSurname”,
“city1” ,
null
]
},
{
“titles”: [
“ADDRESS”,
“NAME”,
“SURNAME”,
“city”,
“cap”
],
“values”: [
“street example”,
“test name”,
null,
null,
“cap1”
]
}
]
Is there anybody who can help me?