Overview
The "Documents: Update" operation in this custom n8n node allows you to update an existing document within a specified collection and database in Appwrite. This is useful for workflows where you need to modify stored data, such as updating user profiles, changing order statuses, or editing content records.
Practical examples:
- Updating a user's profile information in a user management system.
- Modifying the status of an order in an e-commerce workflow.
- Editing metadata or attributes of a document in a content management process.
Properties
| Name | Type | Meaning |
|---|---|---|
| Database ID | String | The unique identifier of the database where the document resides. |
| Collection ID | String | The unique identifier of the collection containing the document to be updated. |
| Document ID | String | The unique identifier of the document you want to update. |
| Body | JSON | The new data to update the document with. Should be a JSON object with attribute values. |
Output
The output will be a JSON object representing the updated document as returned by the Appwrite API. The structure typically includes:
- All fields of the document after the update (including any unchanged fields).
- System fields such as
$id,$collectionId,$databaseId,$createdAt,$updatedAt, etc. - Any custom attributes defined in your collection schema.
Example output:
{
"$id": "unique_document_id",
"$collectionId": "your_collection_id",
"$databaseId": "your_database_id",
"$createdAt": "2024-06-01T12:00:00.000Z",
"$updatedAt": "2024-06-02T15:30:00.000Z",
"attributeName1": "new-value1",
"attributeName2": "new-value2"
}
Dependencies
- Appwrite instance: You must have access to an Appwrite server.
- API Key & Project ID: Credentials are required and should be configured in n8n under "appwriteApi".
- Environment variables: None specific, but ensure your n8n instance can reach your Appwrite endpoint.
Troubleshooting
- Invalid credentials: If authentication fails, you'll see an error like
Auth settings are not valid. Double-check your API key, project ID, and endpoint URL. - Document not found: If the provided Document ID does not exist, the node will throw an error from the Appwrite API indicating the document was not found.
- Schema mismatch: If the body JSON does not match the expected schema of the collection, the update may fail with a validation error.
- Permission denied: Ensure the API key has write permissions for the target database and collection.