You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "waleedahmed0001 (via GitHub)" <gi...@apache.org> on 2023/06/13 19:30:01 UTC

[GitHub] [age] waleedahmed0001 commented on issue #934: Updating properties for multiple nodes in a graph database using a single query without specifying each node individually

waleedahmed0001 commented on issue #934:
URL: https://github.com/apache/age/issues/934#issuecomment-1589899856

   Yes, you can update properties for multiple nodes using a single query. The recommended approach is to use the MATCH clause with a condition to match the desired nodes, and then use the SET clause to update the properties. Here's an example:
   
   ```
   MATCH (n:label4)
   WHERE n.id IN [123, 456, 789]
   SET n.newProperty = 'new value'
   ```
   
   In this example, the MATCH clause matches all nodes with the label "label4". The WHERE clause filters the nodes based on their "id" property, using the IN operator to specify a list of IDs you want to update. Finally, the SET clause updates the "newProperty" of the matched nodes to the desired value ('new value' in this case).
   
   You can adjust the WHERE clause condition to match the specific criteria for your nodes. For example, you can use a range of IDs or other property conditions to select the nodes you want to update.
   
   Note that it's important to be careful when updating properties for multiple nodes, as a poorly constructed query can result in unintended updates. Always double-check your query and consider running a sample query with a RETURN clause before executing the SET operation to ensure you are targeting the correct nodes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org