> For the complete documentation index, see [llms.txt](https://docs.pentaho.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pentaho.com/pdia-data-integration/10.2-data-integration/pdi-transformation-steps-reference-overview/mongodb-output/options-mongodb-output/mongo-document-fields-tab.md).

# Mongo document fields tab

![MongoDB Output Mongo document fields tab](/files/er6qJoYYAK4D9CLbL02k)

Use the **Mongo document fields** tab to define how field values coming into the step are written to a Mongo document. The **Modifier policy** column controls when the execution of a modifier operation affects a particular field. You can use modifier policies when the data for one Mongo document is split over several incoming PDI rows or when it is not possible to execute different modifier operations that affect the same field simultaneously.

Enter the following information in the transformation step fields:

| Column                         | Field Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Name**                       | Names of the incoming fields.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| **Mongo document path**        | The hierarchical path to fields in a document in dot notation format.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| **Use field name**             | Whether to use the incoming field name as the final entry in the path. The values are `Y` (use incoming field names) and `N` (do not use incoming field names). When set to `Y`, a preceding period (.) is assumed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **NULL values**                | <p>Whether to insert null values in the database. The values are:</p><ul><li>Insert NULL</li><li>Ignore</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **JSON**                       | Indicates the incoming value is a JSON document.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| **Match field for update**     | Indicates whether to match a field when performing an upsert operation. The first document in the collection that matches all fields tagged as Y in this column is replaced with the new document constructed with incoming values for all the defined field paths. If a matching document does not exist, then a new document is inserted into the collection.                                                                                                                                                                                                                                                                                                                                                                      |
| **Modifier operation**         | <p>Specify in-place modifications of existing document fields.</p><p>The modifiers are:</p><ul><li><strong>N/A</strong></li><li><strong>$set</strong></li></ul><p>Sets the value of a field.</p><ul><li><strong>$inc</strong></li></ul><p>Sets the value of a field if the field does not exist. If the field exists, increases (or decreases, with a negative value) the value of a field.</p><ul><li><strong>$push</strong></li></ul><p>Sets the value of a field if the field does not exist. If the field exists, appends the value of a field.</p><ul><li><strong>$</strong></li></ul><p>(the positional operator for matching inside of arrays).</p>                                                                           |
| **Modifier policy**            | <p>Controls when execution of a modifier operation affects a field. The values are:</p><ul><li><strong>Insert\&Update</strong></li></ul><p>The operation is executed whether or not a match exists in the collection (default). The lnsert\&Update modifier policy (upsert) allows you to specify fields to match when performing an upsert operation. Upsert only replaces the first matching document. Modifier upserts can be used to replace certain field values in multiple documents.</p><ul><li><strong>Insert</strong></li></ul><p>The operation is executed on an insert only (when the match conditions fail)</p><ul><li><strong>Update</strong></li></ul><p>The operation is executed when match conditions succeed.</p> |
| **Get fields**                 | Populates the **Name** column of the table with the names of the incoming fields.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **Preview document structure** | Opens a dialog showing the structure that will be written to MongoDB in JSON format.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.pentaho.com/pdia-data-integration/10.2-data-integration/pdi-transformation-steps-reference-overview/mongodb-output/options-mongodb-output/mongo-document-fields-tab.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.
