0

Does MongoDB store it's data like SQLite does at all? A single file. From what I could see it is using "wiredTiger," but I can't find a specific file for my database I created.

  • This isn't a current option (as at MongoDB 3.4), but what is your goal as far as having a single file? Are you aiming to backup a single database? – Stennie Nov 15 '16 at 20:03
  • I really just wanted to know how it worked. I thought I was missing something. – johnny Nov 15 '16 at 20:11
2

As at MongoDB 3.4, all of the standard storage engines (WiredTiger, MMAPv1, ..) create multiple files in the dbPath. For example, in WiredTiger there are a number of metadata files, journal files, and a file per collection and per index (see: Why is an empty MongoDB database so big?). Multiple files generally allow more granular concurrency and storage management; single-file databases are more common for embedded use cases.

The file and directory layout is dependent on the storage engine and server configuration options, so it is conceivable that someone could develop a new MongoDB storage engine which has a more concise file layout (but I'm not aware of anyone having done so).

Irrespective of the layout on disk, you could use the standard mongodump utility to create a single compressed & archived backup of a database to copy and restore on another system using mongorestore. The archive feature is available in MongoDB 3.2 or newer. For more information, see Archiving and Compression in MongoDB Tools.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.