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. Native MongoDB data can be either normalized or flattened to create a relational schema.
Normalization takes place upon initial connection with the driver or when creating a new schema map using the Schema Tool. During the normalization process, 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.
Flattening can only take place by creating a schema map using the Schema Tool. When flattening data with the Schema Tool, 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.
Whether you normalize or flatten your native data, the relational schema is written to the schema map configuration file. This configuration file is an XML file that may be shared across servers. The configuration file can be subsequently modified using the Schema Tool.