6 releases (breaking)

0.14.0 Oct 29, 2020
0.13.1 Oct 26, 2020
0.13.0 Aug 21, 2020
0.11.0 May 2, 2020
0.9.0 Oct 4, 2019

#44 in #version-manager

Download history 29/week @ 2023-10-28 20/week @ 2023-11-04 26/week @ 2023-11-11 18/week @ 2023-11-18 39/week @ 2023-11-25 26/week @ 2023-12-02 21/week @ 2023-12-09 17/week @ 2023-12-16 29/week @ 2023-12-23 10/week @ 2023-12-30 16/week @ 2024-01-06 18/week @ 2024-01-13 19/week @ 2024-01-20 20/week @ 2024-01-27 11/week @ 2024-02-03 34/week @ 2024-02-10

88 downloads per month
Used in 3 crates (2 directly)

Apache-2.0 and CC-PDDC licenses

56KB
1.5K SLoC

crates.io

monger - MongoDB Version Manager

monger is a command-line version manager of MongoDB. It downloads and stores version of MongoDB to the directory ~/.monger and facilitates running different mongodb binaries (mongod, mongo, etc.) by version.

Supported platforms

monger currently only supports Linux and OS X/MacOS

Installation

Assuming that you have Rust installed, simply run cargo install monger. Note that you'll need to have ~/.cargo/bin on your PATH to run monger.

Usage

To print help info:

monger --help

To print the version:

monger --version

Listing installed versions

The command monger list will print out all versions of MongoDB being managed by your installation of monger, as well as an entry listed as "system" if you have a version of mongod installed on your PATH (e.g. from a package manager installation of mongodb).

Download MongoDB versions

To download a version of MongoDB, use the command monger get <VERSION>, where can be a full semantic version, a release candidate, a major and minor version (which will download the latest non-release candidate version with the given major and minor version), or the word "latest" (which will download the latest stable release of MongoDB):

monger get 3.5.12
monger get 3.4.8-rc1
monger get 3.4
monger get latest

By default, this will do nothing if the version of MongoDB is already installed. To force monger to download and install the verison of MongoDB from scratch, add --force:

monger get 3.4.7 --force

Starting mongod

To start mongod, run monger start <VERSION>, where can be a full semantic version, a release candidate, a major and minor version (which will start the latest non-release candidate version with the given major and minor version), or the word "system" if a version of mongod is present in the user's PATH:

monger start 3.5.12
monger start 3.4.8-rc1
monger start 3.4
monger start system

To specify additional arguments to mongod, simply append --:

monger start 3.4.7 -- --fork --syslog

By default, --dbpath will be set to the directory ~/.monger/db/<VERSION>. To use a different path, pass the --dbpath argument as normal along with any other arguments:

monger start 3.4 -- --dbpath path/to/db --fork --syslog

Running a MongoDB binary

To run a MongoDB binary, run monger run <VERSION> <BIN>, where can be a full semantic version, a release candidate, a major and minor version (which will start the latest non-release candidate version with the given major and minor version), or the word "system" if a version of mongod is present in the user's PATH:

monger run 3.5.12 mongo
monger run 3.4.8-rc1 mongotop
monger run 3.4 mongo
monger run system mongotop

To specify additional arguments to mongod, simply append --:

monger run 3.4.7 mongo -- --host 1.2.3.4 --port 1234

Deleting MongoDB versions

To delete a version of MongoDB managed by monger, run monger delete <VERSION>, where is a full semantic version of an installed MongoDB version:

monger delete 3.5.12
monger delete 3.4.8-rc1

Pruning outdated MongoDB versions

Often after downloading a new release, older patch releases of the same version aren't needed. To delete these, run monger prune. For example, given the versions listed below installed, the marked versions would be deleted:

3.0.14      (deleted)
3.0.15
3.2.10      (deleted)
3.2.16
3.4.6-rc0   (deleted)
3.4.7
3.4.8-rc1
3.5.10      (deleted)
3.5.11      (deleted)
3.5.12

Note that release candidates won't be used to determine the newest stable version installed, but release candidates older than the newest stable release will still be deleted.

Future work

  • Ensure that all errors give proper feedback
  • Improve test coverage
  • Properly detect SSL libraries on MacOS
  • Windows support (?)

Dependencies

~9–15MB
~317K SLoC