Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-12-2020 10:47 AM
i am using the following query-
match p = (a:label1)-->(b:label2) return nodes(p)
its returning me results like this-
[{a1,b1},{a1,b2}, {a2,b3}, {a2,b4}]
but i need result in this form-
[{a1},{a2},{b1},{b2},{b3},{b4}]
i have rather very long path and i just need a list of nodes collected on the way(with properties) to display as search result. the labels are different.
Solved! Go to Solution.
04-14-2020 01:03 AM
Please try
MATCH p=(n:CO)-[:HAS_ITEM]->(m:COI) RETURN collect(distinct n), collect(distinct m )
04-12-2020 01:01 PM
You might try:
MATCH p = (a:label1)-[]->(b:label2)
RETURN a, b
04-12-2020 11:55 PM
it gives me same result..
MATCH p=(n:CO)-[:HAS_ITEM]->(m:COI) RETURN n,m
[
{
"keys": [
"n",
"m"
],
"length": 2,
"_fields": [
{
"identity": {
"low": 8,
"high": 0
},
"labels": [
"CO"
],
"properties": {
"type": "WIRES",
"eref": "E98722"
}
},
{
"identity": {
"low": 12,
"high": 0
},
"labels": [
"COI"
],
"properties": {
"type": "Provide",
"product": "Connection",
"status": "In-Progress"
}
}
],
"_fieldLookup": {
"n": 0,
"m": 1
}
},
{
"keys": [
"n",
"m"
],
"length": 2,
"_fields": [
{
"identity": {
"low": 8,
"high": 0
},
"labels": [
"CO"
],
"properties": {
"type": "WIRES ",
"eref": "E98722"
}
},
{
"identity": {
"low": 14,
"high": 0
},
"labels": [
"COI"
],
"properties": {
"type": "Cease",
"product": "CISCO",
"status": "In-Progress"
}
}
],
"_fieldLookup": {
"n": 0,
"m": 1
}
},
{
"keys": [
"n",
"m"
],
"length": 2,
"_fields": [
{
"identity": {
"low": 10,
"high": 0
},
"labels": [
"CO"
],
"properties": {
"type": "CSP",
"eref": "E08779"
}
},
{
"identity": {
"low": 11,
"high": 0
},
"labels": [
"COI"
],
"properties": {
"type": "Provide",
"product": "Connection"
}
}
],
"_fieldLookup": {
"n": 0,
"m": 1
}
},
{
"keys": [
"n",
"m"
],
"length": 2,
"_fields": [
{
"identity": {
"low": 10,
"high": 0
},
"labels": [
"CO"
],
"properties": {
"type": "CSP",
"eref": "E08779"
}
},
{
"identity": {
"low": 13,
"high": 0
},
"labels": [
"COI"
],
"properties": {
"type": "Provide",
"product": "IP Clear Access",
"status": "In-Progress"
}
}
],
"_fieldLookup": {
"n": 0,
"m": 1
}
}
]
04-12-2020 11:57 PM
my requirement is to get CO and COI as separate nodes in the result.
04-14-2020 01:03 AM
Please try
MATCH p=(n:CO)-[:HAS_ITEM]->(m:COI) RETURN collect(distinct n), collect(distinct m )
04-14-2020 03:15 AM
thats so cool, thanks Vivek
All the sessions of the conference are now available online