'Neomodel: unique_index not working on StringProperty()
I have a company node where the name
should be unique:
class Company(StructuredNode):
name = StringProperty(unique_index=True)
participated = ArrayProperty(StringProperty())
However, when I run the code TWICE to create the company, it creates two nodes with the exact same name:
from neomodel import db
import graph_db
from graph_db.model import Company, Employee, Position, Department, Metric
with db.write_transaction:
acme_inc = Company(name="Acme Inc", participated=[2021]).save()
Is there a reason that this constraint isn't being enforced?
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|