MongoDB (i) MongoDB introduction

Source: Internet
Author: User
Tags mongodb relationships mongodb server unique id

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.