Mingo
Databases

Data Relations

Define foreign key relationships between collections and detect orphaned documents with Mingo's Data Relations feature.

Data Relations

Data Relations lets you define foreign key-like relationships between collections in your MongoDB database. This helps you understand how your data is connected and detect integrity issues.

Defining Relations

Create relations by specifying:

  • Source collection and field — the field that references another collection
  • Target collection and field — the field being referenced (typically _id)
  • Preview field — which field to display when showing a relation preview

For example, an orders.userId field referencing users._id, with users.name as the preview field.

Viewing Relations

The Data Relations section shows all defined relations for the current database. Each relation displays the source and target collections with their linked fields.

Click on any _id value in the Documents view to automatically navigate to the related document in a new tab — this works based on your defined relations.

Orphan Detection

One of the most powerful features of Data Relations is orphan detection. Mingo scans your data and finds documents where the foreign key reference points to a document that no longer exists.

This helps maintain data integrity by identifying:

  • Documents referencing deleted records
  • Broken references from data migrations
  • Inconsistencies between related collections

Bulk Operations

After detecting orphans, you can perform bulk operations on the orphaned documents, such as deleting them or updating the broken references.

Export / Import

Export your relation definitions as JSON to share them with your team or back them up. Import definitions to quickly set up relations on a new database.

Collection Exclusion

Exclude collections from relation management that you don't want to participate in relation tracking (e.g. system collections or temporary collections).