Connections and reverse engineering
Moon Modeler allows you to visualize existing MongoDB databases. You can connect to your locally running or cloud-based MongoDB database, Cosmos DB API for MongoDB or AWS Amazon DocumentDB. To manage your database connections, click the Connections button on the main toolbar.
Then click the button Create a new connection to open a modal form. Select MongoDB from the type drop-down.
Connecting to locally running MongoDB
If your MongoDB is running locally, specify the name, URL and either define the database name directly or click the Load databases button. The authentication and SSH settings might not be required at all.
Connecting to MongoDB Atlas cloud database
On tab Server, specify the URL to your MongoDB Atlas cluster, and if you know the name of your database type the name to the Database input field.
Then click tab Authentication and define values for authentication settings.
If you want to list all available databases, go back to tab Server and click Load databases.
After saving your connection, execute the reverse engineering by clicking the Connect and load existing database structure button.
How the reverse engineering feature works
Let’s say we have two simple collections in our MongoDB. “Buyer” collection contains documents similar to this one:
And “Cart” collection contains documents that have a reference to the buyer collection:
The result – a visualization of the MongoDB database structure
If you establish the connection to your MongoDB Atlas database and execute reverse engineering, Moon Modeler will detect the collections, references and visualize the structure in a form similar to an ER diagram (entity relationship diagram).
Where to find the connection string to MongoDB Atlas?
Note: The screenshots below, of course, don’t show Moon Modeler but the MongoDB Atlas administration user interface.
Sign-in to your MongoDB Atlas account, then navigate to Clusters and click the Connect button.
A new form opens. Click option Connect using MongoDB Compass. Another form will be displayed and at bottom of the form, you will find the URL. Based on your settings, you may skip the username/password part of the URL and the database name at the end of the path.
Now you have the URL. What about the authentication? In MongoDB Atlas administration, navigate to the section Database Access.
In this area, you can manage users. Click Edit to see details. As you can see, by default SCRAM is used for authentication. And that’s what you need to know for the Authentication tab in Moon Modeler.