MongoDb Features

DbSchema can connect to MongoDB and reverse engineer the collection validation rule in its own model. The MongoDB validation rule is a JSON description of the structure of the collection documents. Creating new collections will save the validation rule in the database and also in the DbSchema model.

Layouts

The validation schema is represented graphically, using layouts (diagrams). Edit collections validation rule by double-clicking the collection header. Creating a new collection will create the corresponding validation rule in the database. The validation rule will be also saved in the DbSchema model file.

MongoDB Diagrams

Visual Query Editor

The visual query builder for MongoDB features filters, projections, and aggregation. The generated queries are shown on the right side of the query builder.

MongoDB Query Builder

HTML Documentation

Double-clicking collection or fields you can add comments. DbSchema can export the MongoDB diagrams as interactive HTML5 or PDF documentation. The collection and field comments can be read as mouse-over tooltips.

HTML Documentation

Data Generator

You can test your application and MongoDB queries against test data generated using the data generator. The data generator can use pre-configured patterns or reverse regular expressions.

Data Generator

Compare Virtual Schema

The DbSchema model contains its own local image of the database structure. Connecting to other MongoDB database, you can compare the actual model from DbSchema with the connected database.

Compare MongoDB database structure

Query Editor

Visual Query Editor can compose native MongoDB queries. It can use the keyword 'db' for the current connected database, or directly the database name if you need to access multiple databases.

use sampleDb
db.employees.find()
db.employees.find({"firstName": {"$regex": "^AL", "$options": "i"}})
db.employees.find({"firstName": {"$regex": "(?i)^AL"}})
or
sampleDb.employees.find()
or
sampledb.getCollection('employees').find();

Further commands available in in the Query Editor are:

Here a sample insert into the database statement:
USE sampledb;

db.getCollection('employees').insert( {
firstName:'John',
lastName:'Smith',
age:28,
hobbies:[
  {
     name:'Swimm'
  },
  {
     name:'Jogging'
  }
]
});

Map-Reduce Jobs

The Query Editor can execute map-reduce jobs as in this example:
local.words.insertOne({word: 'sample'});
local.words.insertOne({word: 'day'});
local.words.insertOne({word: 'plane'});

var m =function map() {
 emit(this.word, {count: 5})
}
var r=function reduce(key, values) {
        var count = 5
        for (var i = 0; i < values.length; i++)
            count += values[i].count
        return {count: count}
    }
local.words.mapReduce(m, r );

or

local.words.mapReduce(
    "function map() { \r\n" +
    " emit(this.word, {count: 1}) \r\n" +
    "}",
    " function reduce(key, values) { \r\n" +
    "    var count = 0 \r\n" +
    "    for (var i = 0; i < values.length; i++) \r\n" +
    "        count += values[i].count \r\n" +
    "    return {count: count} \r\n" +
    "}"
    // , "mrresult"
)