Home > Net >  Neo4j Indexes and Constrains in a JS Application
Neo4j Indexes and Constrains in a JS Application

Time:07-07

I am using NodeJS to create a Neo4j application. I want to add constraints like:

CREATE INDEX ON :User(userId)

But I do not know where to place this statement. If run twice, it throws an error of type:

Neo4jError: An equivalent index already exists, ...

Where should I place this statement?

CodePudding user response:

You should try this:

CREATE INDEX userIdIndex IF NOT EXISTS FOR (n:User) ON (n.userId)
  • Related