MongoDB is a cross-platform, document-oriented database that provides high performance, high availability, and scalability convenience. MongoDB works on the concept of collection and documentation.
Database
A database is a collection of physical containers. Each database has its own set of files on the file system. A single MongoDB server typically has multiple databases.
Collection
A collection is a set of MongoDB documents. It is equivalent to an RDBMS table. The collection exists in a single database. The collection does not execute the pattern. The documents within the collection can have different areas. Typically, all files in a collection are of the same or related purpose.
Document
A document is a set of key-value pairs. File dynamic mode. Dynamic mode refers to documents in the same collection that do not require a collection of common fields that have the same field or structure group, and can accommodate different types of data.
The table given below shows RDBMS terminology using MongoDB relationships
RDBMS |
MongoDB |
Database |
Database |
Table |
Collection |
Tuple/row |
Document |
Column |
Field |
Table Join |
Embedded Documents |
Primary Key |
Primary Key (Default key _id provided by MongoDB itself) |
Database Server and Client |
Mysqld/oracle |
Mongod |
Mysql/sqlplus |
Mongo |
Sample Document
The example given below shows a blog site, which is simply a comma-separated key-value pair for the document structure.
{_id:objectid (7df78ad8902c) title:' MongoDB Overview ', Description:' MongoDB is no SQL database ', by:' Tutorials Point ', URL:' Http://www.yiibai.com ', Tags: [' MongoDB ', ' database ', ' NoSQL '], likes:100, Comments: [{User:' User1 ', message:' My first comment ', dateCreated:NewDate (2011,1,20,2,15), like:0}, {User:' User2 ', message:' My second Comments ', dateCreated:NewDate (2011,1,25,7,45), like:5 } ]}
_ID is a 12-byte hexadecimal number that guarantees the uniqueness of each document. You can provide _id to insert the document at the same time. If not provided, then each document of MongoDB provides a unique ID. These 12 bytes, the first 4 bytes are the current timestamp, the next 3 bytes of the machine ID, the next 2 bytes of the process ID of the MONGODB server and the remaining 3 bytes are simple increment values.
MongoDB (i) MongoDB introduction