MongoDB Enhancements

Several enhancements have been implemented for MongoDB, which are supported for both REDB and RES. These enhancements are:

Multiple Datatype Support and Union of Attributes in Arrays

Multiple datatype support has been enhanced for the following scenarios:

  • Scenario1: Objects within an array have an attribute with different datatypes

    For example, the following image shows an array of objects, address, that contains an attribute, city, with data that has string, integer, and double datatypes.

  • Scenario2: Multiple objects (documents) in a collection have attributes with the same name but different datatypes

    For example, the following image shows a collection with multiple objects. Each object contains an attribute, city, with data that has string, integer, and double datatypes.

These scenarios are supported via the Multiple Datatypes section of the MongoDB Collection Field Editor. In the scenarios explained above, after REDB or RES, a union of attributes is done, and the Physical Data Type of such attributes is set to Multiple. The actual datatypes are listed in the Multiple Datatypes section. For example, in the following image, the array, address, has an attribute, city with multiple datatypes. The Physical Data Type for city is set to Multiple and the Multiple Datatypes section lists that it has values with String, Integer, and Double datatypes.

Enhanced Array Display

For collections with multiple arrays of geometric or geospatial like data, REDB or RES fetches the collection’s schema instead of array elements and displays only the 0th element of such arrays in the ER diagram.

For example, consider a collection, GeometryCollection, which has multiple arrays.

Reverse engineering this collection results into the following ER diagram, where the schema of the collection is reverse engineered instead of array elements. Also, only the 0th element is displayed for each array.

The following image shows that Collection Field Editor for the reverse engineered collection.

Handling Arrays with Heterogeneous Elements

For heterogeneous arrays, REDB or RES fetches only distinct datatypes and presents unique datatypes in the model.

For example, the following image shows a heterogeneous array, tags, with one Boolean, one Double, two Integer, and two String elements.

Reverse engineering this collection fetches distinct array element datatypes and is presented as shown in the following image. The array, tags, has single instance of elements with String, Integer, Double, and Boolean datatypes.