The logical structure of MongoDB
Mainly consists of three parts: Document, Collection (collection) and database.
MongoDB Document: The basic unit of data in MongoDB, equivalent to a row of records in a relational database, each document has a special key "_id", which is unique within the collection to which the document belongs.
Collection (collection): equivalent to the concept of a table in a relational database
A hierarchy of documents, collections (collection), databases (database) such as:
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/89/72/wKiom1gTGZXgC73LAACYRx-TDJ4952.png-wh_500x0-wm_3 -wmp_4-s_3043951476.png "title=" qq picture 20161028172449.png "alt=" Wkiom1gtgzxgc73laacyrx-tdj4952.png-wh_50 "/>
Document corresponds to rows in relational data (row)
Tables (table) in the corresponding relational data set (collection)
Database (database) in relational data
MongoDB Data Directory stores all MongoDB data files
[[Email protected] data]$ ll Total dosage 1212436drwxr-xr-x. 2 mongo dbmon 69 10 month 28 17:15 diagnostic.datadrwxr-xr-x. 2 mongo dbmon 27 10 Month 28 15:25 JOURNAL-RW-------. 1 mongo dbmon 67108864 10 Month 28 15:25 LOCAL.0-RW-------. 1 mongo dbmon 1073741824 10 Month 28 17:15 LOCAL.1-RW-------. 1 mongo dbmon 16777216 10 Month 28 17:14 Local.ns-rw-r--r--. 1 mongo dbmon 6 10 Moon 28 15:17 mongod.lock-rw-r--r--. 1 mongo dbmon 69 10 month  28 15:17 STORAGE.BSON-RW-------. 1 mongo dbmon 67108864 10 Moon  28 17:00 SYKDB.0-RW-------. 1 mongo dbmon 16777216 10 Month 28 17:00 sykdb.nsdrwxr-xr-x. 2 mongo dbmon 6 10 Month 28 15:54 _tmp
Inside MongoDB, each database contains an. ns file and some data files, such as: LOCAL.NS,LOCAL.0,LOCAL.1, and the number of files increases as the volume of data grows.
Each table corresponds to a namespace, and each index has a corresponding namespace. The metadata for these namespaces is placed in the *.ns file.
MongoDB has a pre-allocated space mechanism, and pre-allocated files are populated with 0, so MongoDB always keeps extra space and free data files. Each time a new file is generated for a data file, it will be twice times the size of the previous data file. Like my local.0 is 67108864,LOCAL.1 or 1073741824.
Reference: MongoDB Series-Architecture
This article is from the "just out of the shell of the Birds" blog, please be sure to keep this source http://qhd2004.blog.51cto.com/629417/1866883
MongoDB's system