Mapping objects to tables
- Last Updated: July 30, 2025
- 2 minute read
- DataDirect Connectors
- ODBC
- MongoDB 8.0
- Documentation
Data mapping describes how elements are mapped between two distinct data
models. To support SQL access to a MongoDB database, the MongoDB database must be mapped
to a relational schema. The driver creates the relational schema by mapping MongoDB data
in a normalized, flattened, or mixed view of the data.
- Normalized view: MongoDB collections are normalized into sets of parent-child tables. The child tables correspond to complex types, such as arrays and embedded documents (or subdocuments), and have a foreign key relationship to the parent table. For more information, see "Normalized view."
- Flattened view: MongoDB collections are flattened into single, relational tables. All fields, including those that may comprise complex types, are organized as columns within the relational table. For more information, see "Flattened view."
- Mixed view: The driver generates an optimized view of the data in which MongoDB collections are mapped to a normalized view that flattens certain objects into columns in the parent table. For example, subdocuments are mapped as columns in the parent table, while most arrays and nested subdocuments are mapped to separate child tables. See "Mixed view" for more information.
The driver generates the relational view upon the initial connection to a data
source. By default, the driver generates a mixed view of relational data. You can
determine the relational view using the Schema Format (SchemaFormat)
option.
At connection, the relational schema is written to the schema map configuration file. This configuration file may be shared by multiple users. Note that users must have appropriate privileges to the exposed collections to access them.
Note: The names of relational tables
demonstrated in this section are generated based on the default behavior of the
driver. You can modify how the driver generates table names using the Qualify
Normalized Names (
QualifyNormalizedNames) option.