I have a neomodel Model:
from neomodel import StructuredNode, StringProperty, UniqueIdProperty, db
db.set_connection('bolt://neo4j:password@masir_neo4j:7687')
class City(StructuredNode):
id = UniqueIdProperty()
name = StringProperty(index=True, default="city")
I've installed labels to the neo4j database by this command which is represented in the neomodel's documentation:
neomodel_install_labels manage.py app.models --db bolt://neo4j:password@masir_neo4j:7687
After running this command the City node is added to the neo4j database, then I'm trying to add some data to the database by Python shell, here is the result:
But, as you can see there is nothing in the City node.
Then I tried to save data by cypher_query and it worked:
Why the save function of neomodel isn't working?


According to https://neomodel.readthedocs.io/en/latest/properties.html
All nodes in neo4j have an internal id (accessible by the ‘id’ property in neomodel) however these should not be used by an application. Neomodel provides the UniqueIdProperty to generate unique identifiers for nodes (with a unique index)
So you can't have a property called
id. You need to use a different property name, for exampleuid(anything other thanidwould work)