Delete Node
AI-generatedOverview
This node enables interaction with a Neo4j graph database, specifically supporting the deletion of nodes based on specified criteria. The "Delete Node" operation allows users to remove nodes that match given labels and properties. It is useful in scenarios where you need to clean up or manage graph data by removing specific nodes programmatically, such as deleting user profiles, outdated records, or any entities identified by certain attributes.
For example, you might delete all nodes labeled "Person" with a specific ID property, optionally detaching their relationships first to avoid errors.
Properties
| Name | Meaning |
|---|---|
| Match Labels | Labels of the nodes to delete (optional). You can specify one or more labels like "Person", "User". |
| Match Properties | JSON object defining properties to find the nodes to delete. Values can include expressions for dynamic matching. This is required. Example: {"ID": "{{ $json.ID }}"} |
| Detach Relationships | Boolean flag indicating whether to delete all relationships connected to the node before deleting the node itself. If true, it performs a "DETACH DELETE" to avoid errors caused by existing relationships. If false, deleting a node with relationships will cause an error. Default is true. |
| Options > Return Delete Count | Boolean option to return the count of deleted nodes after the operation completes. Default is false. |
Output
The node outputs JSON data representing the result of the delete operation. If the "Return Delete Count" option is enabled, the output includes the number of nodes deleted. Otherwise, the output may be empty or contain minimal confirmation data.
No binary data output is involved.
Dependencies
- Requires connection to a Neo4j graph database.
- Needs an API key credential for authenticating with the Neo4j instance.
- The node depends on internal routing and operation modules to perform actions but these are bundled internally.
Troubleshooting
- Error when deleting nodes with relationships: If "Detach Relationships" is set to false and the node has existing relationships, the deletion will fail. To fix this, enable "Detach Relationships" to allow safe deletion.
- Invalid JSON in Match Properties: The "Match Properties" field must be valid JSON. Errors in formatting or invalid expressions can cause failures. Ensure correct JSON syntax and valid expressions.
- No nodes deleted: If no nodes match the provided labels and properties, the operation will not delete anything. Verify the correctness of your matching criteria.
- Authentication errors: Ensure the API key credential is correctly configured and has sufficient permissions to delete nodes in the Neo4j database.
Links and References
- Neo4j Official Documentation
- Cypher Query Language - DELETE Clause
- n8n documentation on Using Credentials