Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-29-2022 12:56 AM
hello
im trying create node with 1 unique property called name so i try create something like this
Solved! Go to Solution.
06-29-2022 05:47 AM - edited 06-29-2022 05:47 AM
You should pass the whole list to your query and UNWIND it like this:
UNWIND $words AS item
MERGE (n:Word {name: toLower(item)})
06-29-2022 03:05 AM
Hello @hoseinmorshedy 😊
If you are on the latest version of Neo4j (4.4.x):
CREATE CONSTRAINT constraint_Word IF NOT EXISTS FOR (n:Word) REQUIRE n.name IS UNIQUE;
If you create a unique constraint, then you should use MERGE clause instead of CREATE:
MERGE (n:Word {name: toLower($your_string)})
Regards,
Cobra
06-29-2022 04:30 AM
but how we make it uncase sensitive?
i dont want to create 2 node called A and a
06-29-2022 04:41 AM - edited 06-29-2022 04:42 AM
You can't do it directly, that's why I used the toLower() function to make sure it creates only one node.
06-29-2022 04:54 AM
one more thing in node js im trying to get all index of array with foreach and then merge it into neo4j the problem i have is it just merge 1 item into database my code is:
06-29-2022 05:47 AM - edited 06-29-2022 05:47 AM
You should pass the whole list to your query and UNWIND it like this:
UNWIND $words AS item
MERGE (n:Word {name: toLower(item)})
All the sessions of the conference are now available online