Time for a new MongoDB GUI?

We'll match you for any remaining time on your current plan.
Let's talk
Radoslav Toth
June 8, 2022

Data relations in Mingo

When documents reference each other, they usually do so by the _id of the referenced document. There are several types of document relations (such as one-to-many, one-to-one, many-to-one, many-to-many), but we can generally say that there is always a parent document (the one referencing) and a child document (the one being referenced).

For example, you could have the following document in Orders referencing a document in Users collection:

  _id: new ObjectId("8cc43bb95dd51baa970ae4ad"), 
  user: new ObjectId("51baa970ae4ad8cc43bb95dd")
  _id: new ObjectId("51baa970ae4ad8cc43bb95dd"), 
  firstname: 'John',
  lastname: 'Smith'

When you are viewing the Orders collection, the ObjectId("51baa970ae4ad8cc43bb95dd") does not say much to you. It would be much more preferable to see that it is actually John Smith.

Mingo's aproach to the problem

To make your data more readable, Mingo analyzes possible data relations within a database and shows more human information about the referenced documents and the relation itself.

Human readable info about the document that is being referenced.

Mingo searches through samples of documents from each collection and identifies fields that look like an _id. Then it tries to find those _id's in the database. When found, it creates a relation and guesses the best field to show as a preview. In the example above, the document references the Schools collection document and the "name" field was chosen to be the preview value.

The same relation is then shown in the referenced document:

Relations are automatically analyzed upon first connect to the database.

Managing data relations

Usually, there is very little you have to do for relations to work properly in Mingo. To view the currently known relations, right-click the database in the sidebar and select Data Relations:

The list of Data Relations will be shown:

List of data relations within a database

In the above screenshot, the first relation means the following: Documents from the Billing collection reference by the field "school_id" documents in the Schools collection. The "name" field in the Schools collection was chosen to show a more human value.

Add a new relation

Mingo let's you add a new relation in the list of relations (mentioned above) or gives you the opportunity to do so when it guesses a field is an _id, but there is no relation set so far:

Edit an existing relation

To edit a relation from the list of data relations, just click the pencil icon. You can also edit the relation where the preview is shown in the documents. Just click the cog icon.

Follow the instructions in the modal to update or remove the relation.

The last checkbox is worth mentioning: "Update all preview paths for 'Schools' to 'name'". This allows you to update the preview field for collection in all existing relations at once. It is very handy when you have several relations poiting to the same collection.

Delete an existing relation

To delete a relation from the list of data relations, just click the trash icon. You can also delete the relation where the preview is shown in the documents. Just click the cog icon and press the delete button in the bottom left corner of the modal.

Other considerations

Extra information is requested from the database to show the related document's preview field. Mingo is optimised to do this efficiently, but if you have many relations, it could have performance implications. If this negatively affects your user experience or puts a burden on your server, minimize the number of relations to those you really need. You can also delete them all completely.

Mingo's algorithm analyzing the relations is not perfect if your data is not consistent or you use very specific values for your _ids. In such case, we recommend setting your relations manually.

The preview fields are selected automatically by Mingo using simple criteria. In case an inappropriate field is selected, you can edit the relation and update the preview field manually.

Read more

Share MongoDB Configurations, Queries, Aggregation pipelines, NodeShell scripts, and more!

Are you tired of sending connection configurations which is a security risk? Or sending queries, pipelines, and scripts to your team members and then keeping the track of the latest version? Do you wish you could simply share your work with your team for faster and more efficient collaboration? Well, we have some great news […]

Tools for MongoDB

Are you tired of constantly struggling to create or update your MongoDB URIs? We know the feeling, and that's why we created the MongoDB URI Builder. This simple, yet powerful tool is designed to help you build or update your MongoDB URIs with ease. And the best part? It's completely free to use! With the […]

Mingo's security

At Mingo, we understand the importance of keeping your data safe and secure, which is why we've implemented two layers of security to ensure that your data is protected at all times. Two layers of security Everything that happens in Mingo, stays in Mingo. None of your data, connection information nor passwords are sent or […]
Radoslav Toth

MongoDB security for beginners

MongoDB security is based on role-based access control (RBAC). It enables users to control access to data based on their roles in the organization. With RBAC, users can be assigned to roles with specific privileges. Each role is granted access to certain resources, such as databases and collections. This ensures that only authorized users can […]

What is MongoDB?

MongoDB is quickly becoming one of the most popular databases in the world. It is a document-oriented database, which means it stores data in documents, rather than in tables like traditional databases. This makes it an ideal choice for applications that require flexibility and scalability. MongoDB is an ideal choice for applications that require fast […]

MongoDB NodeShell

Mingo's NodeShell let's you execute JavaScript code to work with data directly in Mingo. This is NOT MONGO SHELL, though. The command must be a regular async JS function with a return value. This allows complex code with loops, conditions and variable initialization to be executed. This code must be a definition of a async function and […]
Radoslav Toth

Compare and sync entire MongoDB databases 

Do you ever need to download the production DB to your localhost for development purposes? Or just sync changes from one DB to another? This can be done using Mingo’s Compare & Sync tool. You don’t need to write scripts or use the terminal mongodump / mongorestore functions, anymore. With Mingo’s Compare & Sync tool […]
Radoslav Toth

Mingo’s keyboard shortcuts

We are all tired of new shortcuts we have to learn. Mingo’s shortcuts mimic what you are already used to from a browser or your dev tool. However, Mingo also has some new intuitive “hovering” shortcuts. Just hover over a document and press space or X to select the document. Or hover a document and CMD+C / CTRL+C to copy document value.  To […]
Radoslav Toth

Smart search

The majority of queries we execute on MongoDB collections are very simple. We usually search for an _id, an email or username and we do this many times over every day. To make such searches simple and fast, Mingo provides a few great hacks for you. Value as query First of all, indexed fields can […]
Radoslav Toth

5 best MongoDB GUI in 2022

What is a MongoDB GUI client? MongoDB GUI is a graphical interface for MongoDB. It provides a way to view and manipulate data in MongoDB databases using the MongoDB API or MongoDB Shell. As you may know, you can query your data through the command line, but this gets messy and you can get easily […]

Download Mingo now

The best MongoDB GUI Admin. Intuitive • Fast • Secure
Download Now