Data file structure
Extent
Within each data file, MongoDB organizes the data of the stored Bson document and the B-tree index into the logical container "Extent". As shown (My-db.1 and my-db.2 are the two data files of the database):
- A file can have multiple extent
- Each extent will only contain a collection of data or indexes
- The data or index of the same collection can be distributed within multiple extent. These extent can also be divided into several files
- The same extent doesn't have the data and the index.
Record Records
There are multiple "records" in each extent, each containing a record header and MongoDB Bson document, plus some extra padding space. Padding is that MongoDB allocates some extra unused space when inserting records, so that future documents become larger without the need to migrate documents elsewhere. The record header starts at the size of the entire record, including the record's own location and the location of the previous record and the last record. Can be imagined as a double Linked List.
Transferred from: Http://www.mongoing.com/blog/file-storage
The MongoDB data file structure--record is a doubly linked list of embedded Bson, consisting of multiple record or index extent