# How to Use m Version Aliases like 'latest' and 'stable' for MongoDB Installation

> Simplify MongoDB installation with m version aliases. Easily install the latest or stable release using m latest or m stable without exact version numbers.

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

---

**Use `m latest` to install the newest MongoDB build including release candidates, or `m stable` to install only officially stable releases, without specifying exact version numbers.**

The `m` version manager by aheckmann simplifies MongoDB installation by providing **m version aliases** that resolve to specific release numbers automatically. Instead of memorizing patch versions, you can use semantic aliases that always point to current builds.

## Understanding the latest and stable Aliases

`m` provides two primary aliases that behave differently regarding pre-release software.

### What latest Means

The **`latest`** alias resolves to the highest version number available in the MongoDB release feed, **including release candidates (RCs) and development snapshots**. When you run `m latest`, the script invokes `display_latest_version()` defined in `bin/m` (lines 1596–1622), which parses the complete version list and selects the maximum semantic version regardless of stability markers.

### What stable Means

The **`stable`** alias resolves to the newest **official stable** build, explicitly filtering out release candidates and development versions. This uses `display_latest_stable_version()` in `bin/m` (lines 1624–1654), which applies series-specific rules to exclude any version string containing `-rc` or similar pre-release identifiers.

## Installing MongoDB with Version Aliases

You can invoke these aliases in several forms depending on whether you want to install immediately, preview the version, or target a specific release series.

### Basic Installation Commands

To install and activate the aliased version immediately:

```bash

# Install the absolute newest build (may include RCs)

m latest

# Install the newest stable build only

m stable

```

Both commands download the resolved MongoDB version if not already cached, then update the active symlink to point to that installation.

### Checking Versions Without Installing

To see what version an alias resolves to **without** triggering a download, use the double-dash flag form:

```bash

# Print the latest version string (including RCs)

m --latest

# Output: 8.0.6

# Print the latest stable version string

m --stable

# Output: 8.0.5

```

These flags invoke the same `display_latest_version()` and `display_latest_stable_version()` functions but exit after printing the version identifier rather than proceeding to the installation logic.

### Targeting Specific Release Series

You can constrain either alias to a specific major.minor series (e.g., `7.0`) to get the most recent patch for that line:

```bash

# Install the most recent stable patch for the 7.0 series

m --stable 7.0

# → Resolves to 7.0.14 (or latest 7.0.x stable)

# Install the most recent patch for 7.0 including any RCs

m --latest 7.0

# → Could resolve to 7.0.15-rc0 if available

```

The script parses the series argument in the `case` block around lines 916–923 of `bin/m`, then filters the version list to match only versions starting with that series prefix before applying the `latest` or `stable` selection logic.

## How m Resolves Version Aliases Internally

The alias resolution logic lives in the core `bin/m` script. When you invoke `m` with `latest` or `stable`, the argument parser sets a `flavour` variable (lines 916–923) that determines which display function to call.

- **`display_latest_version()`** (lines 1596–1622): Iterates through the remote version manifest, sorts semantic versions numerically, and returns the highest value regardless of pre-release tags.
- **`display_latest_stable_version()`** (lines 1624–1654): Applies a regex filter to exclude versions matching `-rc`, `-alpha`, or `-beta` patterns, then returns the highest remaining version.

Both functions support an optional series argument (e.g., `7.0`) which pre-filters the candidate list before the stability check occurs.

## Summary

- **`m latest`** installs the newest MongoDB build including release candidates, while **`m stable`** restricts installation to official stable releases only.
- Use **`m --latest`** or **`m --stable`** to preview version strings without downloading.
- Append a series number (e.g., **`m --stable 7.0`**) to limit alias resolution to a specific major.minor release line.
- The resolution logic is implemented in `bin/m` via `display_latest_version()` (lines 1596–1622) and `display_latest_stable_version()` (lines 1624–1654).

## Frequently Asked Questions

### What is the difference between m latest and m stable?

`m latest` resolves to the highest version number available, including release candidates and development snapshots, making it suitable for testing upcoming features. `m stable` explicitly filters out pre-release versions and only resolves to officially tagged stable releases, making it the safer choice for production environments.

### How do I install a specific MongoDB series like 7.0 using m?

Pass the series number as an argument to the alias flag: `m --stable 7.0` or `m --latest 7.0`. This constrains the search to versions starting with that series (e.g., 7.0.x) and installs the most recent patch for that line according to the stability filter you specified.

### Can I see what version m will install before actually installing it?

Yes. Use the double-dash form of the flags: `m --latest` or `m --stable`. These commands invoke the version resolution functions—`display_latest_version()` and `display_latest_stable_version()` in `bin/m`—but stop after printing the version string to stdout, without triggering the download or activation steps.

### Where does m store the version alias resolution logic?

The alias resolution logic is contained in the main `bin/m` script of the aheckmann/m repository. Specifically, the `display_latest_version()` function (lines 1596–1622) handles the `latest` alias, while `display_latest_stable_version()` (lines 1624–1654) handles the `stable` alias. The argument parser that sets the `flavour` variable to trigger these functions appears around lines 916–923.