# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.waterflai.ai/studio/studio-builders/flow-components-nodes/document-metadata-update-node.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
