Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-13-2022 10:38 PM
I recently started learning and working on Neo4j. I got a task which wants me to make a similar query for different use case. But i am unable to understand the below query which is provided as a reference to me. Can someone explain this query to me? Thanks
createReminder": "merge (rem : reminder{node_pk : {rem_id}}) set rem+= {node_name : {rem_data}, reminder : {rem_data}} with rem match (per : tmpPerson{node_pk : {wopid}}) with rem, per merge (per)-[r:has_reminder]->(rem) on create set r+= {on_date : {date}, is_cancelled : false} on match set r+={on_date : {date}} with per, rem return per, rem
10-14-2022 10:09 AM
I am assuming you are using a driver whose syntax for parameters is enclosed in curly brackets. The first thing the query is doing is merging a node with label 'reminder' and node_pk property equal to {rem_id}. This will either match the node if it exists, or create it if it does not exists. The result is bound to the variable 'rem' for further reference in the query. Once merged, the query is updating the node's properties 'node_name' and 'reminder', both with the value of {rem_data}. The next step in the query is to match on a node with label 'tmpPerson', whose 'node_pk' property equals {wopid}. This node if found is bound to the variable 'per'. The query will stop if the node is not found. If found, the query then merges a relationship between the 'per' node and the 'rem' node. Due to the 'merge', the relationship will be created if it does not exists. The query then updates the properties on the relationship, by setting the relationship's properties 'on_date' and 'is_cancelled' when the relationships is created, or updating just the 'on_date' property if the relationships already existed. Finally, the 'per' and 'rem' nodes are returned.
What is your task?
10-20-2022 10:35 PM
Hi, thank you so much for replying. Helped a lot. My task was to add some new fields ( rem_date, rem_time, rem_timestamp) in the Reminder Node. I was able to do that. One more question. I have date and time coming from front end separately. I need to save them by combining both of them. And then once saved, i need to fetch the reminder by comparing dates of the reminders and sort them. Is their any existing function which i can use to combine the date and time and save them as a timestamp field?
All the sessions of the conference are now available online