The file is bigger than the machine's memory

MongoLoader » Use cases » Huge files

Download MongoLoader Free Trial »     Buy MongoLoader Now »

The situation

Warehouse extracts arrive as multi-gigabyte CSVs, log collections hold hundreds of millions of documents, and the machine doing the work is an ordinary one - a laptop, or a server that is busy with something else. The usual failure is not measured in hours: the import simply stops when memory runs out, usually partway through, leaving a half-loaded collection behind.

What you do

  1. Choose the file or the collection as usual, and the destination.
  2. Run it. The data is processed in chunks: rows are read, converted and written as they go, so the amount of memory used does not grow with the size of the file or the collection.
  3. Watch the progress and the log, which report row counts as the run proceeds - so a long job is not a black box.
  4. For repeated loads, save the task as a session and run it from the command line overnight.

A large MongoDB export in progress, showing the log and row counts

The same chunked approach applies in both directions, so "a 30 GB CSV into a collection" and "that collection back out to files" are both jobs an ordinary machine can finish. Data never leaves the machine: the file is read locally and the documents go to the MongoDB server you name.

What it will not do

Related

Both directions: one tool for both directions, collection to file, folder to collection. Cleaning during the export: clean the data on the way out. The other direction after editing: export, edit, import back. Unattended runs: command line, sessions.