-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eager Loading & Serialising Relationships #16
Comments
Could you explain more about the differences between |
The idea is that you can get just the node (ie Adam lives in Swindon) or information on the relationship (Adam has lived in Swindon since 2015). A relationship will return properties for the relationship and the end node:
Whereas the node will only return the end node:
The same is true for |
I recently encountered a problem with the type 'relationships' in defining schema (it works only for type relationship). I'm using typescrypt and the problem can be avoided by defining the whole schema object as type 'any' instead of Neode.SchemaObject `import Neode from "neode"; // . . . children: { |
Opening up a private discussion with @noumaans.
I'm planning to write an enhancement to improve the serialisation of relationships. Say we have a Movie node, and we want to also eager load the Director of the movie.
We'll get something similar to the following:
This approach has a couple of problems:
Proposed Changes
Or a new type:
relationship
type but use this to return the relationship and node.Define:
To return:
In the example above, the properties for the relationship are flattened and then a
node
key for the node at the other end.Neo4j's API's define relationships as having a
startNode
,endNode
andother
. Because the definition has an in/out direction, the only applicable name would beother
- that's not ideal. If Person A knows Person B, usingstartNode
orendNode
could lead to inconsistent returns.Potentially, this could be defaulted to
other
, with an option to configure the key name if required.This could also default to the target name:
All comments welcome...
The text was updated successfully, but these errors were encountered: