Lets assume this simplified schema:
type default::Genre {
required property name -> std::str {
constraint std::exclusive;
};
};
type default::Movie {
required property title -> std::str;
property year -> std::int64;
multi link genres -> default::Genre;
};
When I query the movies like this:
select Movie {
title,
year,
genres: {name}
}
limit 1
I get this response:
[
{
"title": "Troja",
"year": 2004,
"genres": [
{
"name": "Action"
},
{
"name": "War"
},
{
"name": "Adventure"
},
{
"name": "History"
}
]
}
]
Is there a way to change the query to get this response instead
[
{
"title": "Troja",
"year": 2004,
"genres": [
"Action", "War", "Adventure", "History"
]
}
]
I looked through the documentation but I also don't what keyword to search for.
Now I figured out how to write the query to do this
This will return a set, but the corresponding JSON will show a list:
If you really need an array instead you can use the array_agg function like this: