Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4j - Constraint on property existence

I'm trying to have a constraint such that any node with the "Users" label has to have certain properties (like username, password, etc...)

When trying the CREATE CONSTRAINT ON (u:Users) ASSERT exists(u.username) We get an error saying: Unable to create CONSTRAINT ON ( users:Users ) ASSERT exists(users.username) Neo.DatabaseError.Schema.ConstraintCreationFailure

This command was taken from the official 2.3.2 docs and the command was run from the browser interface.

So, what am I doing wrong? Also, is it recommended to store user sensitive information in neo4j?

Thanks.

like image 293
dlvhdr Avatar asked Feb 14 '16 13:02

dlvhdr


2 Answers

Property exist constraints are part of the Enterprise edition of Neo4j and do not exist in Community edition. The documentation has a box stating this at http://neo4j.com/docs/stable/query-constraints.html.

like image 123
Stefan Armbruster Avatar answered Oct 10 '22 21:10

Stefan Armbruster


I agree, very dissapointing. It is a basic feature that changes the behavior of the application and makes it impossible to move databases between editions. Exists() is not an enterprise feature, it is common function. Until this is fixed, Neo4j should let the user know in the server response when the constraint creation fails that this is an Enterprise feature.

like image 35
Niels Andersen Avatar answered Oct 10 '22 23:10

Niels Andersen