> For the complete documentation index, see [llms.txt](https://docs.waterflai.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.waterflai.ai/studio/studio-builders/flow-components-nodes/document-metadata-update-node.md).

# Document metadata update Node

### Overview

The Document Metadata Update Node allows you to modify or add metadata fields to existing documents in your flow. It provides flexibility in updating document metadata either by merging with existing metadata or completely reinitializing it with new values.

Usage cost: 0 credit

### Configuration

#### Settings

1. **Document Selection**
   * Document\*: Select the source document to update
   * Only single documents are supported (not document arrays)
2. **Metadata Configuration**
   * Metadata Fields\*: JSON object containing the metadata fields to update
   * Reinitialize: Toggle to clear existing metadata before applying new fields
     * When enabled: Replaces all existing metadata
     * When disabled: Merges new fields with existing metadata

#### Output Ports

* `document` (Document): Updated document with new metadata
  * Contains the original document content
  * Updated metadata based on configuration

### Best Practices

1. **JSON Structure**
   * Use valid JSON format for metadata fields
   * Use double quotes for keys and string values
   * Structure nested data appropriately
2. **Metadata Management**
   * Document metadata schema changes
   * Use consistent field names
   * Consider data types when updating

### Common Issues

* Invalid JSON syntax in metadata fields
* Missing required metadata fields
* Inconsistent field naming
* Special characters in JSON
* Nested object handling
