0

I'm quite new to neo4j. I'm developing a web app(using express.js and async) that does a POST request, which in turn creates a triangle of nodes and relationships. So, there are 6 queries and I want to use auto-increment ID (or rowID) of the created nodes (using id(a)) to create relationships.

As I saw in another post(Node identifiers in neo4j), rowID should not be relied for reuse. But, I have no other way of identifying my nodes (unless if I create an index on all the properties which is a pain).

Hence, my question, can I use rowID for this use-case ? If not, what kind of use case suits better for rowID ?

Community
  • 1
  • 1
user2103008
  • 414
  • 7
  • 19

2 Answers2

2

Create your own id and store it on the node as a property, if you have no unique id that you can use.

Eve Freeman
  • 32,467
  • 4
  • 86
  • 101
2

If you only need an id to create the triangles, then you can use id(n), but probably you can just create the triangle with a single cypher statement.

Perhaps you can share more of your code/domain?

Usually you should have a business-key / -id that you can use.

Michael Hunger
  • 41,339
  • 3
  • 57
  • 80
  • That's what I ended up using, but now my code looks more procedural than object-oriented. I can live with it for now till I figure out a better way of doing this. – user2103008 Nov 26 '13 at 19:19