DbSchema Database Designer

DbSchema | MongoDB Diagram Design

Publish on DbSchema Blog >>>

MongoDB is one of the fastest-growing databases in the market. It offers great flexibility by focusing on a unique approach in the way they store data. MongoDB uses a JSON-like format that can contain different kinds of structures. Two documents from the same collection can have different fields or references.

By using this kind of storage, MongoDB is known for being a schemaless, because it doesn’t impose any constraints on the database objects. This is the main feature that offers so much flexibility and scalability for MongoDB.

Being schemaless has its disadvantages. Working with a big schemaless database will impose a higher degree of complexity. This can make it harder for you to manage data in MongoDB because it requires a lot of knowledge. Working with complementary tools such as DbSchema can help you visualize the MongoDB diagram and overcome this problem.

Create a visual schema for MongoDB

Even though MongoDB doesn’t have a traditional schema, there is a way to deduce it. A collection several objects. No matter how different, every object has a name and an ID that can be referenced in other objects. Let’s take a look at an example:

 > db.persons.findOne()
 {
   "first_name" : "John",
   "last_name" : "Leaf",
   "email" : "[email protected]",
   "address" : [
     {
       "city_id" : 3,
       "street" : "Seaseme St",
       "number" : 12,
       "zip" : 123555
     }
   ]
 }

This is an example of a JSON object from the ‘persons’ collection. This has an embedded object named “address”, that also has it’s particular fields. When DbSchema connects to MongoDB, it searches every object in the schema and looks for similarities. In this case, the collection for this particular object will look like this:

persons collection

As you can see in the image above, DbSchema created a collection for the “persons” object, including the embedded “address” object. The “_id” field from “persons” was autogenerated by MongoDB.

Managing the schema

Once the diagram was created, the possibilities are endless. The database can be edited just by clicking the objects, without any queries. You can split the database in multiple layouts, each focused on a specific part of the database. For example, you can create a layout for the “persons” collection, one for “product collection”, and one for “countries” collection.

layouts

Documentation

If you want to document the database, all you have to do is double click on a collection or a field and add a comment. If you want to add a more general comment, then add a callout on the diagram.
The virtual diagram can be exported to documentation in HTML5 or PDF formats. It will include all the comments and callouts. The documentation can be opened with any browser. To read the comments, hover the collection with the mouse.

Design a MongoDB schema in a team

DbSchema stores the schema information as a model file. This enables you to work on the “schema” without database connection & synchronize it later.
It is also possible to compare & synchronize two different versions of the same model file, thus making it easier to work on the same model in a team.

Query Tools and Virtual Foreign Keys

You can use a set of powerful tools to browse and edit data in your MongoDB database. The Relational Data Editor helps you to visualize data from multiple collections at the same time. This is possible via virtual foreign keys, a concept unique to DbSchema.

Using Query Builder, you can create visual queries without using the complex MongoDB native language. If you want to write queries manually, you can always do this by using the Query Editor, specially designed for MongoDB.

Visually Manage Databases using DbSchema

DbSchema is a databases client and visual designer. DbSchema has a free Community Edition, which can be downloaded here.
DbSchema main features include:

DbSchema Designer alt >

Interactive Diagrams

Design tables, column and foreign keys directly in diagrams, by double-clicking them. Changes will be saved to the design model and, if DbSchema is connected to the database also into the database. More.


Connection Dialog alt >

Simple Connection Dialog

Choose the database location, the user and password, and simply get connected. Choose 'Edit Manually' into the JDBC URL combo to enter a custom URL. More.


Relational Data Explorer alt >

Relational Data Explorer

Explore data from multiple tables simultaneously, using foreign keys or virtual foreign keys. Double-click cells to edit the data. More.


Query Builder alt >

Query Builder

Create SQL Queries featuring JOINS, GROUP BY, ORDER BY just using the mouse. More.


SQL Query Editor alt >

SQL Query Editor

Edit and execute SQL Queries. The editor is autocompletion-enabled. More.


Schema Synchronization alt >

Design Schema in Team & Schema Deployment

DbSchema is using the design model, a copy of the schema structure, independent of the database.
The design model can be saved to file and shared in a team.
Connecting to another database you may compare the design model with the database, commit the differences or merge them in the design model. More.


Dark Theme alt >

Dark Theme

Configurable styles & dark theme. More.


Many features are available in the free Community edition.
The Pro edition adds capabilities to save the design to the model file, design schema in team and deploy the schema on multiple databases.


DbSchema can be downloaded for free. No registration is required.