Flattened view
- Last Updated: July 30, 2025
- 1 minute read
- DataDirect Connectors
- ODBC
- MongoDB 8.0
- Documentation
The following example shows how the source data is flattened.
A data source has a collection called employee with the following structure:
{"_id": "pdn313",
"name": "Charlotte",
"manager": {"name": "Robert",
"emails": ["bob@email.com", "robert@email.com"]
}
}
The employee collection would be flattened
into a relational table with the following structure:
| _ID | NAME | MANAGER_NAME | MANAGER_EMAILS_1 | MANAGER_EMAILS_2 |
|---|---|---|---|---|
| pdn313 | Charlotte | Robert | bob@email.com | robert@email.com |
All fields are retained as separate columns in the resulting relational table.
Simple types such as
_id and name correspond directly to columns. In turn, subdocuments are flattened
into columns using the <objectname>_<fieldname> pattern. Next, the emails array is flattened into two columns, using an
extended version of the <arrayname>_<arrayindex> pattern: <objectname>_<arrayname>_<arrayindex>.Note: As subdocuments or arrays are
discovered at deeper and deeper levels, the
<objectname>_<fieldname> or <arrayname>_<arrayindex> pattern is extended, for example,
<objectname>_<objectname>_<fieldname>.Note: To avoid creating very large tables, arrays containing twelve
or more elements are normalized into child tables by default. You can configure this
behavior using the Array Normalization Threshold (ArrayNormalizationThreshold)
option.