MongoDB connections and reverse engineering

 

Note: this page is outdated. Please visit page Visualization of existing MongoDB databases

 

Connections to MongoDB and Moon Modeler

Moon Modeler allows you to visualize existing MongoDB databases. You can connect to your locally running or cloud-based MongoDB database. 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 dropdown or click the MongoDB icon.

New MongoDB connection

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.

MongoDB Server

Then click tab Authentication and define values for authentication settings.

MongoDB Authentication

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.

Connect and load

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:

Document 1

And "Cart" collection contains documents that have a nested structure and a reference to the buyer collection:

Document 2

 

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 nested documents 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.

Cluster

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.

URL

Now you have the URL. What about the authentication? In MongoDB Atlas administration, navigate to the section Database Access.

authentication

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.

user and password

 

The end

#

Copyright: 2024 Ideamerit s.r.o. All rights reserved. Legal