m
helps you download, use, and manage multiple versions of the MongoDB serverand command-line tools.MongoDB Atlas Global Cloud Database. Deploy, operate, and scale a MongoDB database in the cloud with just a few clicks. Fully elastic and highly available by default, MongoDB Atlas is the easiest way to try out the latest version of the database, MongoDB 4.2. Secure from the start. NOTE: v3.x was recently released with breaking API changes. Download the right MongoDB version from MongoDB; Create a database.
This can be useful for development & testing environments. For example, testingrelease upgrades/downgrades or potential behavior differences between versions.
Where possible
m
will try to download the distro-specific binaries for yourO/S and version. If a binary appears to be unavailable, m
will ask if you wantto try building from source.NOTE: Building MongoDB from sourcerequires you to preinstall all of the relevant dependencies & toolchain to buildthe desired version of MongoDB. Installing those is outside the scope of what
m
does.Prerequisites
To install binary packages
m
requires a 64-bit O/S which:- is a Supported Platform for the version of MongoDB you are trying to install
- includes the
bash
shell
Environments that should work include:
- Linux (RHEL/CentOS, Debian/Ubuntu, Amazon Linux)
- macOS 10.11 (El Capitan) and later
- Windows 10 with Ubuntu on Windows
- Docker using a supported Linux distro
Installation
m
is a bash
script which can be installed & updated via npm
for convenience:or installed by cloning the GitHub repo and running
make install
:or fetched via
wget
and copied to a location of your choice:Downloading MongoDB Binaries
Specify a MongoDB server version to try download a binary package (if available for your current O/S) or switch to a previously downloaded copy. After
m
successfully downloads or switches to a specified version of MongoDB, those binaries will become the default in the install path (typically /usr/local/bin/
; see Details below for more information).You can also specify a release series to download the latest available revision:
List installed binaries:
Use or download the latest official release:
Use or download the stable official release:
Check what the latest available release is:
Check what the current stable release is:
Download a custom or patched version of MongoDB from a tarball:
Download and build a version of MongoDB from source (NOTE: assumes build requirements are installed):
Download an Enterprise release:
Select a MongoDB version without prompting for confirmation if a download is required:
Removing Binaries
Remove some previously installed versions:
Binary Usage
Multiple versions of MongoDB can be downloaded and targeted directly.
Ask
m
for the binary path for a specific version that has already been downloaded:Ask
m
for the binary path for the latest revision of a release already downloaded:Start up
mongod
3.4.9 regardless of the active version:Execute a script with the 3.4.9
mongo
shell regardless of the active version:Execute a script with a 3.4.9
mongo
shell and some additional flags:When installing or changing the active version you might want to run custom scripts:
Multiple scripts may be added for any event. To add two
pre change
scripts:Scripts are executed in the order they were added.
List all pre change hooks:
List all post install hooks:
To remove a post install hook:
To remove all post install hooks:
Usage
Output from
m --help
:Details
By default
m
downloads MongoDB binaries to /usr/local/m/versions in subdirectories named after the release version (3.2.16, 3.4.9, ...). Activated MongoDB binaries are symlinked into the bin
directory in /usr/local. To alter where m
operates, export the M_PREFIX environment variable with your preferred path prefix.Previously downloaded versions of MongoDB can be activated using
m <version>
orselected using of the variations in the Binary Usage section above.License
Inspiration
Yes tj, this is nearly identical to n. Huge thanks!
Disclaimer
This software is not supported by MongoDB, Inc. under any of their commercial support subscriptions or otherwise. Any usage of
m
is at your own risk. Bug reports, feature suggestions, and questions can be posted in the Issues section on GitHub.