Can I create a node in neo4j with specified id?

我们两清 提交于 2020-01-03 08:28:08

问题


I want to hold relationships in neo4j but (maybe, I've not decided yet) to keep the objects in different DB (sort of Redis). And if to do so, it would be good to sync IDs in storage db and in neo4j. So, can I create a node in neo4j passing the ID to it?

PS project in PHP and accessing neo4j via REST API.


回答1:


You normally can't, only if you use the BatchImporter, http://docs.neo4j.org/chunked/snapshot/indexing-batchinsert.html, you can specify the IDs to use.




回答2:


Otherwise it is sensible to use external id's as node properties and index the nodes on those properties. So you have bi-directional resolutions of your external id's.

The indexing can also be done using the auto-indexer, so it happens automatically on node creation, update and removal.

You might also look into Neo4jPHP as a library to access Neo4j's REST API.



来源:https://stackoverflow.com/questions/8626470/can-i-create-a-node-in-neo4j-with-specified-id

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!