Reverse Engineer MongoDB Walkthrough

From ER/Studio Data Architect
Jump to: navigation, search

Go Up to MongoDB Support

Use the steps in this topic to reverse engineer your MongoDB database.

  1. Install ER/Studio Data Architect.
  2. Choose File > New, and then select Reverse-engineer an existing database.
  3. Click Login.
    Newdb.png
  4. On the following window, choose the type of connection you would like. For MongoDB select Native Connection, and then choose MongoDB.
    Wizard pg1.png
  5. Type your MongoDB URI or click Advanced Options to manually enter connection and authentication information. In our example we are using the server IP address (10.150.40.240) and the default admin account which we entered the username and password in the Advanced Options section.
  6. Click Next to connect to the MongoDB server.
  7. Now you have authenticated and connected to the MongoDB server, you can select, or type in the name of the database you would like to reverse engineer.
    Wizard pg2.png
    • To choose from a list, click the [...] button to the right of the Database List. In our example we are using the library database.
    Wizard DB Select.png
  8. Click Next.
  9. Select the tables or collections you would like to reverse engineer, and then click Next..
    Wizard pg3.png
  10. On Page 4 you can choose the desired layout. You can change this again at a later time from within the model explorer, using the layout menu.
    • There is also an option to Handle Repeated Elements. For denormalized objects that are repeated across multiple parents, you can choose to combine them into one object. Here if nested objects have the same name the wizard will combine all the fields into the same object.
    Wizard pg4.png
  11. Page 5 allows you to set the type of physical model, any external naming standards, and a summary of the selected objects.
    Wizard pg5.png
  12. Click Finish to complete the wizard.
  13. The wizard will generate a physical model rendered in Rolled-up' mode
    Mongodb physical model.png
    • All the Nested Objects are rolled-up into the Collections. To see the Nested Objects as separate symbols on the diagram, select Diagram/Display Options DiagramObject Display.png
    Mongodb physical intermediate model.png
  14. ER/Studio Data Architect separates the logical data model from the physical representation for a specific DBMS. After the reverse engineering, the logical model is shown. Click on the Physical model node in the tree to see the Physical model of the reverse engineered.
    Finalmodel.png
  15. Collections are indicated by square corners. All collections have an _id field. Nested objects are indicated by rounded corners.
    Nested.png
    Containment relationship lines show how nested objects are used by collections. The diamond endpoint connects to the parent object and the other end connects to the nested object. Containment relationships can contain one or many which are signified by a 1 or * at the end of the relationship.
  16. Add Collections to your model by selecting the Add Collection tool and dropping them in.
    Add collection.png
  17. Add nested objects to your model by selecting the Add Nested Object tool and dropping them in. If you have a collection or other nested object selected before using the nested object tool, then a containment relationship is automatically created from that selected object.
    Add nested.png
    You can double-click on any object to edit, add, modify, or remove fields.
  18. Open the Collection Editor by double-clicking an object.
    Collection editor.png
    From here, you are able to set field names and datatypes, as well as other informational data, such as a definition.
    You can also mark fields as Arrays by checking the Array option in the field editor.
    Array.png

Magic Wand Icon.pngTip: Go to diagram and object display options and check the Datatype option under Table to show the data types of your fields in the model.

Datatype.png

See Also