update
Replace all fields in a SurrealDB record with new data while preserving the record ID and creation timestamp. Use for complete record updates rather than partial modifications.
Instructions
Update a specific record with new data, completely replacing its content.
This tool performs a full update, replacing all fields (except ID and timestamps) with the provided data. For partial updates that only modify specific fields, use 'merge' or 'patch' instead.
Args: thing: The full record ID to update in format "table:id" (e.g., "user:john", "product:laptop-123") data: Complete new data for the record. All existing fields will be replaced except: - The record ID (cannot be changed) - The 'created' timestamp (preserved from original) - The 'updated' timestamp (automatically set to current time)
Returns: A dictionary containing: - success: Boolean indicating if update was successful - data: The updated record with all new values - error: Error message if update failed (only present on failure)
Examples: >>> await update("user:john", {"name": "John Smith", "email": "john.smith@example.com", "age": 31}) { "success": true, "data": {"id": "user:john", "name": "John Smith", "email": "john.smith@example.com", "age": 31, "updated": "2024-01-01T10:00:00Z"} }
Warning: This replaces ALL fields. If you only want to update specific fields, use 'merge' instead.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
data | Yes | ||
thing | Yes |