Skip to content
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

how to get a instance with Increment id #65

Open
shaojiajun314 opened this issue Aug 4, 2021 · 4 comments
Open

how to get a instance with Increment id #65

shaojiajun314 opened this issue Aug 4, 2021 · 4 comments

Comments

@shaojiajun314
Copy link

shaojiajun314 commented Aug 4, 2021

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

@shaojiajun314
Copy link
Author

how to get a instance with Increment id

@shaojiajun314 shaojiajun314 changed the title how to how to get a instance with Increment id Aug 4, 2021
@EvdH0
Copy link
Contributor

EvdH0 commented Aug 4, 2021

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

@shaojiajun314
Copy link
Author

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?

@whatSocks
Copy link
Collaborator

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants