---
title: "Upgrade MongoDB"
description: "Learn how to upgrade MongoDB up to v4.4.15 in an installation of CircleCI server v4.7."
platform: "Server"
doc_version: "Server 4.7"
last_updated: "2026-09-28"
---

> For current CircleCI product defaults, deprecated patterns, and Cloud/Server differences, see [AGENTS.md](https://circleci.com/docs/AGENTS.md).
>
> For the complete documentation index and site structure, see [llms.txt](https://circleci.com/docs/llms.txt).

# Upgrade MongoDB

MongoDB is a database service used by CircleCI Server. This page describes how to upgrade MongoDB to version `4.4.15`.

MongoDB `3.6.22` is shipped with CircleCI Server v4.7.

## Prerequisites

*   Ensure backups have been taken. You will need a backup of MongoDB to restore to in case anything goes wrong during the upgrade progress.
    
*   You are prepared to modify the `values.yaml`
    
*   `helm upgrade` will work from your system to upgrade the cluster.
    
*   MongoDB root password is available.
    

## Scripted upgrade

We have created a shell script which may be used to upgrade your cluster’s MongoDB instance. See the [MongoDB upgrade script](https://github.com/CircleCI-Public/server-scripts/tree/main/upgrade-mongo-to-4.4). If you wish, you may use the following instructions to manually upgrade your cluster’s MongoDB

## Manual upgrade

### 1\. Upgrade from MongoDB 3.6 to 4.0

1.  Your `values.yaml` must contain the following snippet:
    
    ```yaml
    mongodb:
      image:
        tag: 3.6.22-debian-9-r38
    ```
    
    To begin the upgrade process, change the tag to `4.0.27-debian-9-r118`:
    
    ```yaml
    mongodb:
      image:
        tag: 4.0.27-debian-9-r118
    ```
    
2.  Run `helm upgrade` to update your installation.
    
3.  Once the `helm upgrade` has completed and MongoDB has rolled, `exec` into the pod (with the root password handy) to modify the compatibility version. Be sure to replace `<password>` with your MongoDB root password.
    
    ```bash
    kubectl exec -it mongodb-0 -- mongo -u root -p <password>
    db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )
    ```
    
4.  You will get a `{ "ok" : 1 }` response from Mongo. Exit out of the MongoDB shell and pod.
    

### 2\. Upgrade from MongoDB 4.0 to 4.2

1.  Change the tag to `4.2.21-debian-10-r8`:
    
    ```yaml
    mongodb:
      image:
        tag: 4.2.21-debian-10-r8
    ```
    
2.  Run `helm upgrade` to update your installation.
    
3.  Once the `helm upgrade` has completed and MongoDB has rolled, `exec` into the pod (with the root password handy) to modify the compatibility version. Be sure to replace `<password>` with your MongoDB root password.
    
    ```bash
    kubectl exec -it mongodb-0 -- mongo -u root -p <password>
    db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )
    ```
    
4.  You will get `{ "ok" : 1 }` again. Exit out of the shell and pod.
    

### 3\. Upgrade from MongoDB 4.2 to 4.4

1.  Change the tag one more time to `4.4.15-debian-10-r8`:
    
    ```yaml
    mongodb:
      image:
        tag: 4.4.15-debian-10-r8
    ```
    
2.  Run `helm upgrade` to update your installation.
    
3.  Once the `helm upgrade` has completed and MongoDB has rolled, `exec` into the pod (with the root password handy) to modify the compatibility version. Be sure to replace `<password>` with your MongoDB root password.
    
    ```bash
    kubectl exec -it mongodb-0 -- mongo -u root -p <password>
    db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )
    ```
    
4.  Once you receive `{ "ok" : 1 }`, you have successfully upgraded your MongoDB to 4.4.15.