Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-20-2020 08:02 AM
I am new to Neo4j and have the following node structure in my graph
Name of the node : Test
{
"A": "1",
"B": "2",
"C": "3",
"D": "4",
"E": "5",
"F": "6",
}
My application requires the graph DB to return A, B and C as key-value pairs as-is from the node, something like
A | 1
B | 2
C | 3
I know how to return all the key-value pairs in a specific node using
MATCH (n:Test)
UNWIND keys(n) AS Parameter
RETURN Parameter,n[Parameter] as Value
I am stuck in getting only specific key-value pairs. Any help would be much appreciated!
Solved! Go to Solution.
03-21-2020 12:17 AM
Hi Siddharth
MATCH (n:Test)
UNWIND ['A','B','C'] AS Parameter
RETURN Parameter,n[Parameter] as Value
Hope this helps you.
03-20-2020 02:36 PM
Hi Siddharth,
Wouldn't this work?
MATCH (n:Test)
return t.A, t.B, t.C
Or are you trying to dynamically find properties in some way?
03-20-2020 07:17 PM
This would return only the value of the property. I would also want the name of the property returned in additional to it's value.
03-21-2020 12:17 AM
Hi Siddharth
MATCH (n:Test)
UNWIND ['A','B','C'] AS Parameter
RETURN Parameter,n[Parameter] as Value
Hope this helps you.
03-21-2020 11:12 AM
Welcome to the community !!
use parameter query. If your using Neo4j 4.0
try
:param a =>'A';
MATCH (n:Test{name:$a)
UNWIND keys(n) AS Parameter
RETURN Parameter,n[Parameter] as Value
All the sessions of the conference are now available online