Use the Fields tab to define properties for exported fields. The Fields tab operates in two different modes: Including all fields in a single JSON field, or including selected fields in the output. If you store the output in a single JSON field, you can parse this JSON using the JSON Input transformation step, or by using a User Defined Java Class step.
Enter the following information in the Fields fields:
Option | Definition |
---|---|
Output single JSON field | Specify that the query results in a single JSON field with the String data type (default). |
Name of JSON output field | Specify the field name of containing the JSON output from the server. |
Get fields | Click Get fields to generate a sample set of documents. You can edit the list of field names, paths, and data type for each field in the sample. |
# | The order of this entry in the list. |
Name | The name of the field based on the value in the Path field. The name that appears here maps the name of the field as it appears in the PDI transformation with the field that appears in the MongoDB database. You can edit the name. |
Path |
Indicates the JSON path of the field in MongoDB. If the path shown is an array, you can specify a specific element of the array by passing it the key value in the bracketed part of the array. For example, $.emails[0] indicates that you want the result to display the first value in the array. To display all array values, use the asterisk as the key, like this $.email[*]. If the array contains records, and not just strings, you can specify that you want to display the record like this: $.emails[].sender. |
Type | Indicates the data type. |
Indexed values | Specify a comma-separated list of legal values for String fields. When you specify values in this field, the Kettle indexed data type is applied to the data. If no values are specified, the String data type is applied. Usually, you will only need to modify this field if you are using Weka metadata for nominal fields. |
Sample: array min: max index | Indicates minimum and maximum values for the index in the sampled documents. |
Sample: #occur/#docs | Indicates how often the field occurs and the number of documents processed. |
Sample: disparate types | Indicates if different data types populate the same field in the sampled documents. When several documents are sampled and the same field contain different data types, the Sample: disparate types field is populated with a Y and the Type field displays the String data type. The Kettle type for the field is set to the String data type, for different output value types. |