Download from the MongoDB Download Center. To install with a package manager, select your operating system and package management method in the following steps.
Steps
Note
If you already installed the MongoDB Server with your system's package manager, you likely already have the Database Tools installed. The following command determines if the Database Tools are already installed on your system:
sudo dpkg -l mongodb-database-tools
Download the Database Tools .deb package.
Open the MongoDB Download Center. Using the drop-down menu on the right-hand side of the page:
Select your Linux Platform and Architecture.
Select the
debPackage.Click the Download button.
If installing on a headless Linux system, click Copy Link to the right of the Download button to copy the download link, then use a command line tool such as wget or curl to download the .deb directly on your Linux system.
Install the downloaded package.
Navigate to the directory containing the downloaded .deb package, then run the following command to install the Database Tools using the apt package manager:
sudo apt install ./mongodb-database-tools-*-100.20.0.deb
Note
Be sure to include the leading ./ in the command above, which instructs apt to look for this file in the local directory instead of searching remote repositories.
Note
If you already installed the MongoDB Server with your system's package manager, you likely already have the Database Tools installed. The following command determines if the Database Tools are already installed on your system:
sudo yum list installed mongodb-database-tools
Download the Database Tools .rpm package.
Open the MongoDB Download Center. Using the drop-down menu on the right-hand side of the page:
Select your Linux Platform and Architecture
Select the
rpmPackageClick the Download button
If installing on a headless Linux system, click Copy Link to the right of the Download button to copy the download link, then use a command line tool such as wget or curl to download the .rpm directly on your Linux system.
Download the Database Tools .tgz archive.
Open the MongoDB Download Center. Using the drop-down menu on the right-hand side of the page:
Select your Linux Platform and Architecture.
Select the
tgzPackage.Click the Download button.
If installing on a headless Linux system, click Copy Link to the right of the Download button to copy the download link, then use a command line tool such as wget or curl to download the .tgz directly on your Linux system.
Make the DB Tools available in your PATH.
You may wish to make the Database Tools available in your system's PATH environment variable, which allows referencing each tool directly on the command line by name, without needing to specify its full path, or first navigating to its parent directory.
You can either:
Copy the DB Tools binaries from the extracted directory into a directory already listed in your
PATH, such as/usr/local/bin. Navigate into the extracted directory, then run the following command to copy the binaries:sudo cp * /usr/local/bin/ Add the DB Tools installation directory to your PATH, by editing your shell's configuration file. For example, in
bash, you would edit the~/.bash_profilefile.
Note
Installing the MongoDB Server with Homebrew also installs the Database Tools. The following command determines if the Database Tools are already installed on your system:
brew list | grep mongodb-database-tools
Install Homebrew.
macOS does not include the Homebrew brew package by default. Install brew using the official Homebrew installation instructions.
Tap the MongoDB formula.
In your macOS Terminal, run the following command to download the official MongoDB Homebrew formulae for MongoDB and the Database Tools:
brew tap mongodb/brew
Then, mark the tap as a trusted source:
brew trust mongodb/brew
Download the Database Tools Zip archive.
Open the MongoDB Download Center. Using the drop-down menu on the right-hand side of the page:
Select the
macOS x86_64Platform.Select the
zipPackage.Click the Download button.
Make the DB Tools available in your PATH.
You may wish to make the Database Tools available in your system's PATH environment variable, which allows referencing each tool directly on the command line by name, without needing to specify its full path, or first navigating to its parent directory.
You can either:
Copy the DB Tools binaries into a directory listed in your
PATHvariable, such as/usr/local/bin. Run the following command from the directory containing the DB Tools binaries:sudo cp * /usr/local/bin/ Add the DB Tools installation directory to your PATH, by editing your shell's configuration file. For example, in
bash, you would edit the~/.bash_profilefile.
Download the Database Tools MSI installer.
Open the MongoDB Download Center. Using the drop-down menu on the right-hand side of the page:
Select the
Windows x86_64Platform.Select the
msiPackage.Click the Download button.
Make the DB Tools available in your PATH.
You may wish to make the Database Tools available in your system's PATH environment variable, which allows referencing each tool directly on the command prompt by name, without needing to specify its full path, or first navigating to its parent directory.
Once you've installed the Database Tools, follow the instructions below to add the install directory to your system's PATH environment variable.:
Open the Control Panel.
In the System and Security category, click System.
Click Advanced system settings. The System Properties modal displays.
Click Environment Variables.
In the System variables section, select
Pathand click Edit. The Edit environment variable modal displays.Click New and add the filepath to the location where you installed the Database Tools.
Click OK to confirm your changes. On each other modal, click OK to confirm your changes.
Once set, you can run any of the Database Tools directly from your command prompt. For tool details, see the tool's reference page.
To check the version installed, run the following command:
mongodump --version
Download the Database Tools Zip archive.
Open the MongoDB Download Center. Using the drop-down menu on the right-hand side of the page:
Select the
Windows x86_64Platform.Select the
zipPackage.Click the Download button.
Make the DB Tools available in your PATH.
You may wish to make the Database Tools available in your system's PATH environment variable, which allows referencing each tool directly on the command prompt by name, without needing to specify its full path, or first navigating to its parent directory.
Once you've copied the Database Tools to the desired location on your filesystem, follow the instructions below to add that location to your system's PATH environment variable.:
Open the Control Panel.
In the System and Security category, click System.
Click Advanced system settings. The System Properties modal displays.
Click Environment Variables.
In the System variables section, select
Pathand click Edit. The Edit environment variable modal displays.Click New and add the filepath to the location where you copied the Database Tools.
Click OK to confirm your changes. On each other modal, click OK to confirm your changes.
Once set, you can run any of the Database Tools directly from your command prompt. For tool details, see the tool's reference page.
To check the version installed, run the following command:
mongodump --version
Overview of Binaries
The Database Tools include the following binaries:
Binary Import / Export | |
Creates a binary export of the contents of a | |
Data Import / Export | |
Imports content from an Extended JSON, CSV, or TSV export file. | |
Diagnostic Tools | |
Provides an overview of the time a | |
GridFS Tools | |
Supports manipulating files stored in your MongoDB instance in GridFS objects. |
Common Tasks
After you install the Database Tools, use the following tools to work with your MongoDB data:
To back up a database, see
mongodump.To restore data from a backup, see
mongorestore.To import data into a collection, see
mongoimport.To export data from a collection, see
mongoexport.