Mongo document fields tab

Pentaho Data Integration

Version
9.3.x
Audience
anonymous
Part Number
MK-95PDIA003-15
MongoDB Output Mongo document fields tab

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

Whether to insert null values in the database. The values are:

  • Insert NULL
  • Ignore
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

Specify in-place modifications of existing document fields.

The modifiers are:

N/A
$set
Sets the value of a field.
$inc
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.
$push
Sets the value of a field if the field does not exist. If the field exists, appends the value of a field.
$
(the positional operator for matching inside of arrays).
Modifier policy

Controls when execution of a modifier operation affects a field. The values are:

Insert&Update
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.
Insert
The operation is executed on an insert only (when the match conditions fail)
Update
The operation is executed when match conditions succeed.
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.