I have a javascript app that queries data from neo4j
I want to return only the id and name properties from the "Tag" node. this is my query:
MATCH (t:Tag)
RETURN { id: t.id, name: t.name } AS tag
ORDER BY toLower(tag.name) ASC
The query is running fine, but when I convert the results to json like this:
console.log(JSON.stringify(result.records));
My json looks like this:
[
{
"keys":[
"tag"
],
"length":1,
"_fields":[
{
"name":"Banking",
"id":"e26fbed3-e326-4744-8459-766d59d9b95f"
}
],
"_fieldLookup":{
"tag":0
}
},
{
"keys":[
"tag"
],
"length":1,
"_fields":[
{
"name":"BI",
"id":"c15bc69 d-0892-4f24-b714-bd1f8ac3ee22"
}
],
"_fieldLookup":{
"tag":0
}
},
... etc.
its returning a lot of text I don't need and will create extra traffic across the intenet when I fetch a large number of nodes.
What can I do to only return json that looks like this:
[
{
"name":"Banking",
"id":"e26fbed3-e326-4744-8459-766d59d9b95f"
},
{
"name":"BI",
"id":"c15bc69 d-0892-4f24-b714-bd1f8ac3ee22"
},
... etc.
Thank you