Neo4j Update User icon

Neo4j Update User

根據內部 User ID 更新用戶資訊。,userId: 要更新的用戶內部 ID (UUID),name: 新的用戶姓名 (可選),email: 新的用戶電子郵件 (可選),phone: 新的用戶電話號碼 (可選),notification_enabled: Whether notifications are enabled for the user (optional)。

Neo4j Update User

AI-generated

Overview

This node updates user information stored in a Neo4j graph database based on an internal User ID. It allows modifying fields such as the user's name, email, phone number, and notification settings. If no update fields are provided, it simply retrieves and returns the current user data.

Common scenarios include:

  • Synchronizing user profile changes from external systems into Neo4j.
  • Enabling workflows that modify user contact details or preferences dynamically.
  • Managing user metadata in applications that use Neo4j as their primary user store.

For example, you could update a user's email and enable notifications after they opt-in via a form submission.

Properties

Name Meaning
User ID The internal unique identifier (UUID) of the user to update.
Name New user name (optional).
Email New user email address (optional).
Phone New user phone number (optional).
Notification Enabled Whether notifications are enabled for the user (optional; boolean true/false).

Output

The output is an array of JSON objects representing the updated user nodes. Each object contains a user field with all properties of the user node after the update, including any unchanged fields and an updated timestamp (updated_at).

If no update parameters are provided, the node returns the current user data without modification.

No binary data output is produced by this node.

Example output JSON structure per item:

{
  "user": {
    "id": "uuid-string",
    "name": "Updated Name",
    "email": "updated@email.com",
    "phone": "1234567890",
    "notification_enabled": true,
    "updated_at": "2024-06-01T12:00:00Z",
    ...
  }
}

Dependencies

  • Requires a Neo4j database connection configured with host, port, username, password, and optionally a database name.
  • Needs an API key credential or equivalent authentication token for Neo4j access.
  • Uses the official Neo4j driver library for Node.js.
  • Relies on helper functions for running Cypher queries and parsing errors.

Troubleshooting

  • Missing or incomplete credentials: The node will throw an error if Neo4j credentials are not fully configured (host, port, username, password). Ensure all required fields are set.
  • Connection failures: Errors connecting to Neo4j or opening a session may occur due to network issues, incorrect credentials, or database unavailability. Verify connectivity and credentials.
  • No update parameters provided: If no fields to update are given, the node logs a warning and returns the current user data without changes.
  • Cypher query errors: Invalid user IDs or malformed queries can cause errors. Check that the User ID exists and input values are valid.
  • Session or driver closure errors: Rarely, closing the Neo4j session or driver might fail; these are logged but do not usually affect workflow execution.

Links and References

Discussion