MongoDB

-> MongoDB is an open source document database and leading NoSQL database.
-> MongoDB is a cross-platform, document oriented database that provides high performance, high availability, and easy scalability. MongoDB works on concept of collection and document.

Database
 -> Database is a physical container for collections. Each database gets its own set of files on the system. A single MongoDB server typically has multiple databases.

Collection
-> Collection is a group of MongoDB documents. It is the equivalent of an RDBMS table. A collection exists within a single database. Collection does not enforce a schema. Documents within a collection can have different fields.

Document
-> A document is a set of key value pairs. Documents have dynamic schema. Dynamic schema means that documents in the same collection do not have the same set of fields or structure, and common fields in a collection’s document may hold different types of data.

JavaScriptJava
function Employee() {
this.name = '';
this.dept = 'general';
}
public class Employee {
public String name = "";
public String dept = "general";
}

Database Server and Client

JavaScriptJava
function Manager() {
Employee.call(this);
this.reports = [];
}
Manager.prototype = Object.create(Employee.prototype);

public class Manager extends Employee {
public Employee[] reports = new Employee[0];
}



function WorkerBee() {
Employee.call(this);
this.projects = [];
}
WorkerBee.prototype = Object.create(Employee.prototype);
public class WorkerBee extends Employee {
public String[] projects = new String[0];
}

Relationships
-> Relationships in MongoDB represent how various documents are logically related to each other. Relationships can be modeled via Embedded and Referenced approaches.

Projection
-> In MongoDB, projection means selecting only the necessary data rather than selecting whole of the data of a document

Leave a Reply

Your email address will not be published. Required fields are marked *