django-neomodel icon indicating copy to clipboard operation
django-neomodel copied to clipboard

how to get a instance with Increment id

Open shaojiajun314 opened this issue 4 years ago • 4 comments
trafficstars

How to do, i want to get a record with id, like cql "WHERE ID(n)=number"

shaojiajun314 avatar Aug 04 '21 10:08 shaojiajun314

how to get a instance with Increment id

shaojiajun314 avatar Aug 04 '21 10:08 shaojiajun314

To retrieve a node with an specific property see: https://neomodel.readthedocs.io/en/latest/getting_started.html#retrieving-nodes. As an example: jim = Person.nodes.get(name='Jim')

For indexing you can use UniqueIdProperty() https://neomodel.readthedocs.io/en/latest/module_documentation.html#neomodel.properties.UniqueIdProperty as shown here

EvdH0 avatar Aug 04 '21 15:08 EvdH0

thanks. and i wanna ask another question. the id could be reuse, Is it the reason for the orm you coded, does not provided the api that i want?

shaojiajun314 avatar Aug 05 '21 02:08 shaojiajun314

@shaojiajun314 yes - for example if a node is deleted there could be a future node with the same internal id. This is why it is recommended for you to make your own domain-specific id field.

whatSocks avatar Aug 05 '21 15:08 whatSocks