Return immediatly

When a database query encounters one, it will return instead of returning all.
Match (x)-[*]-(y) return x.name.
What I want to limit 1 is not to display 1, it only returns the first match one instead of the match-all and showing the first.

I am a new guy in the neo4j. I need ur help! Thanks for ur attention!

Hello @gmac0q :slightly_smiling_face:

What you are asking is not very clear. Can you give an example?

Regards,

Cobra

Hello @Cobra :grinning:

I want to find out if there is a special relationship between nodes A and B.
But I don't want to iterate over all nodes, like Match(x)-[r]-(y) Return Exists(r).
Facing the problem, all I need is only to find out if there exists a relation.

One is enough.

Thanks for ur attention!

Regards,

gmac0q

I see, in this case, I advise you to use the count store which allows you to have very fast requests.

Regards,

Cobra

@Cobra, that was an interesting article. I did not know about the count store and use of the apoc method - very helpful.

I am also confused with the requirements. If the goal is to count the number of relationships between two specific nodes, then the following should work. Make sure to replace the 'where' clause predicates to match your selection criteria.

match(a)
where a.name = 'A'
match(b)
where b.name = 'B'
match (a)-[]-(b)
return count(*)

Hello @glilienfield ‌🙂‌

It's not possible:

Limitation - Can’t use the count store with labels present on both start and end nodes

The count store does not keep metadata with respect to labels on both the start and end node.

Regards,

Cobra