neode icon indicating copy to clipboard operation
neode copied to clipboard

How to get Node's relations

Open danecek099 opened this issue 5 years ago • 2 comments

I'm struggling a little with this library. There is basically no documentation, and the examples in readme seems to be outdated.

If I get a node, using instance.first("Node", "key", "value"), how do I get all the relations it has?

I've described them in the model like so contract: { type: 'relationship', relationship: 'CAN', direction: 'out', target: "Contract", eager: true }, but when I do node.get("contract"), it's supposed to return a Collection, which it doesn't, it returns only the last created relation.

What am I missing?

danecek099 avatar May 23 '20 14:05 danecek099

Look at the #104 issue. It helped me to understand the concept and i was able to request and iterate on the resultset including relationships

pihomeserver avatar May 24 '20 06:05 pihomeserver

type: 'relationship' will give you as single relationship, try relationships to get a collection of relationships. Sorry if this is unclear, I know it's confusing but I can't think of a better way of representing this

adam-cowley avatar May 26 '20 07:05 adam-cowley