Bulk Import from MongoDB

This article explains how to dump data from MongoDB and import it into Treasure Data.

Table of Contents

Install Bulk Loader

First, please install the toolbelt, which includes bulk loader program, on your computer.


After the installation, the td command will be installed on your computer. Open up the terminal, and type td to execute the command. Also, make sure you have java as well. Please execute td import:jar_update to download the up-to-date version of our bulk loader:

$ td
usage: td [options] COMMAND [args]
$ java
Usage: java [-options] class [args...]
$ td import:jar_update
Installed td-import.jar 0.x.xx into /path/to/.td/java


Use the mongoexport command to export a collection into JSON (default) or CSV format as shown below:

$ mongoexport --db users --collection contacts --out /tmp/result.json
$ mongoexport --db users --collection contacts --csv --out /tmp/result.csv

For more information, please consult the MongoDB documentation.

Bulk Import from CSV file or JSON file

Please refer Bulk Import from CSV files about how to import CSV files or Bulk Import from JSON files about how to import JSON files.

For further details, check the following pages:

Last modified: Feb 24 2017 09:27:52 UTC

If this article is incorrect or outdated, or omits critical information, please let us know. For all other issues, please see our support channels.