# How to Install the Latest Patch Release in a MongoDB Release Series Using m

> Easily install the latest MongoDB patch release with m. Run m X.Y to get the newest patch version automatically from MongoDB's version manifest.

- Repository: [Aaron Heckmann/m](https://github.com/aheckmann/m)
- Tags: how-to-guide
- Published: 2026-02-23

---

**To install the latest patch release in a MongoDB release series using m, simply run `m X.Y` (e.g., `m 7.0`), which automatically resolves to the newest patch version (e.g., 7.0.19) by querying MongoDB's version manifest.**

The `m` version manager for MongoDB (maintained in the `aheckmann/m` repository) simplifies the process of installing and switching between MongoDB versions. When you need to install the latest patch release in a MongoDB release series using m, the tool treats release series shortcuts like `7.0` or `6.0` as dynamic pointers to the most recent patch build available.

## How m Resolves Release Series to Latest Patches

In the `install_mongo` function within `bin/m` (approximately lines 380-440), the script implements intelligent pattern matching to detect release series arguments and resolve them to specific patch versions.

### Pattern Detection for Series Identification

When you pass a version argument like `7.0` or `7.0-ent`, the script checks against the regex pattern `^([0-9])\.([0-9]+)(-ent)?$` (lines 388-404). This identifies whether you've requested a specific patch version (e.g., `7.0.5`) or a release series that needs resolution to the latest available patch.

### Fetching and Filtering Version Data

The `get_all_versions` helper function (lines 11-33) retrieves the complete MongoDB version catalog from `https://downloads.mongodb.org/full.json`. For series requests, the script filters this JSON response to extract versions matching the requested series:

```bash
version=`echo $all_versions \
  | grep '"version":' \
  | grep -E -o "$series\.[0-9]+$rc" \
  | sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
  | tail -n1`

```

This pipeline sorts versions numerically by major, minor, and patch components, selecting the highest available patch release for installation.

## Installing Community and Enterprise Editions

### Community Edition Latest Patch

To install the latest community patch for a release series, use the series number without a patch component:

```bash
m 7.0

```

This command resolves to the highest available `7.0.x` version, downloads the binaries, and symlinks them into `$M_BIN_DIR`.

### Enterprise Edition Latest Patch

For MongoDB Enterprise builds, append the `-ent` suffix:

```bash
m 7.0-ent

```

The script applies the same resolution logic but targets enterprise-specific distribution URLs, installing the most recent `7.0.x` enterprise build.

## Automation and Scripting Examples

When automating MongoDB installations in deployment scripts or CI/CD pipelines, you can combine series shortcuts with the `use` subcommand to ensure specific versions are active:

```bash
#!/usr/bin/env bash

# Install and activate the latest 6.0 patch release

yes | m 6.0
m use 6.0

```

To check which version is currently active after installation, run `m` without arguments. The active version displays with a `✔` marker next to the version number.

For non-interactive installations that bypass confirmation prompts in automated environments, pipe `yes` into the command:

```bash
yes | m 6.0

```

This supplies the confirmation automatically, allowing the script to proceed with downloading and installing the latest patch release.

## Summary

- **Release series shortcuts**: Use `m X.Y` (e.g., `m 7.0`) to automatically install the latest patch release for that series without knowing the exact patch number.
- **Enterprise support**: Append `-ent` to the series number for enterprise builds (e.g., `m 7.0-ent`).
- **Implementation location**: Resolution logic resides in the `install_mongo` function in `bin/m`, utilizing `get_all_versions` to query MongoDB's version manifest at [`downloads.mongodb.org/full.json`](https://github.com/aheckmann/m/blob/main/downloads.mongodb.org/full.json).
- **Version storage**: Downloaded binaries are symlinked into `$M_BIN_DIR` for immediate use in your PATH.
- **Activation**: Use `m use X.Y` to switch between installed versions after resolution.

## Frequently Asked Questions

### What happens if I run m 7.0 when a newer patch is available?

If you previously installed `7.0.12` but `7.0.19` is now available, running `m 7.0` will detect the newer version and prompt you to install it. Once confirmed, the newer patch replaces the older one as the active `7.0` series installation, ensuring you always have the latest security fixes and features.

### How does m distinguish between community and enterprise builds?

The script checks for the `-ent` suffix in the version argument (captured via the regex `^([0-9])\.([0-9]+)(-ent)?$` in `bin/m`). When present, it filters the version list and download URLs for enterprise-specific artifacts; otherwise, it defaults to community editions.

### Can I automate m installation in CI/CD pipelines without interactive prompts?

Yes. Pipe `yes` into the command (e.g., `yes | m 7.0`) to automatically confirm installation prompts, or set environment variables to suppress confirmation. This approach is essential for scripts that need to ensure the latest patch release is present without human intervention.

### Where does m store the downloaded MongoDB binaries?

According to the source code in `bin/m`, binaries are downloaded and symlinked into the directory specified by the `$M_BIN_DIR` environment variable, making them immediately available in your PATH for execution by subsequent `mongod` or `mongo` commands.