How is data in a MongoDB database stored on disk?

I know that MongoDB accepts and retrieves records as JSON/BSON objects , but how does it actually store these files on disk? Are they *.json as a collection of separate *.json files or as one large file? I have a hunch about the latter, as MongoDB docs claim to work best on ext4/xfs systems that handle large files better. Can anyone confirm?

+49
database mongodb
Nov 08 '10 at 19:44
source share
4 answers

This mongo database is split into a series of BSON files on disk with a size increase of up to 2 GB. BSON is a proprietary format created specifically for MongoDB.

These slides should answer all your questions:

http://www.slideshare.net/mdirolf/inside-mongodb-the-internals-of-an-opensource-database

+31
Nov 08 '10 at 23:40
source share

MongoDB stores data on disk as BSON in the data path directory, which is usually / data / db. There should be two files per collection, collection.0, which stores the data (and this integer then increases as needed) and collection.ns, which stores the name metadata for the collection.

+10
Nov 08 '10 at 20:00
source share

Detailed BSON format documentation can be found here: http://bsonspec.org/

+3
Nov 11 2018-10-11
source share

Prior to mongodb 3.0 http://blog.mongolab.com/2014/01/how-big-is-your-mongodb/ If you enable the wiredtiger storage engine in MongoDB 3.0, it will use the wiredtiger storage model http: //docs.mongodb .org / v3.0 / core / storage / # storage-wiredtiger

+2
Feb 11 '15 at 17:33
source share



All Articles