Overleaf docs
Plans and pricingTemplatesUser docsGo to Overleaf
On-premises
On-premises
  • Welcome
    • Server Pro vs. Community Edition
  • Release notes
    • Release notes 5.x.x
      • Doc version recovery
    • Release notes 4.x.x
    • Release notes 3.x.x
      • Full project history migration
    • Release notes 2.x.x
    • Release notes 1.x.x
    • Release notes 0.x.x
  • Getting started
    • Before you start
    • Requirements
      • Skills needed
      • Hardware requirements
      • Software requirements
    • Microservices
    • Server Pro infrastructure
    • What is the Overleaf Toolkit?
  • Installation
    • Introduction
    • Using the Toolkit
      • 1: Download the Toolkit
      • 2: Familiarize yourself with the Toolkit
      • 3: Initialize the configuration
      • 4. Choose Community Edition or Server Pro
      • 5. Personalizing your instance
      • 6. Post-installation tasks
    • Air-gapped/offline deployments
    • Upgrading TeX Live
  • Configuration
    • Overleaf Toolkit
      • Files and locations
      • Toolkit settings
      • Environment variables
      • Server Pro-only configuration
        • LDAP
        • SAML 2.0
        • Sandboxed Compiles
        • Git integration
        • Templates
        • Adding LaTeX user help
      • Logging
      • TLS proxy
      • Branding
      • Localization
      • Email delivery
      • Redis
      • S3
  • Maintenance
    • docker-compose.yml to Toolkit migration
    • Upgrading your deployment
    • Data and backups
      • Exporting projects
    • Extending TeX Live
    • Horizontal scaling
    • S3 migration
    • Updating MongoDB
  • User and project management
    • User management
      • Username migration
    • Understanding license usage
    • Project management
  • Support
    • Project limits
    • Troubleshooting
    • Getting help
    • Support guides
      • Using templates as an individual
    • Overleaf user docs
Powered by GitBook
LogoLogo

Discover Overleaf

  • Home
  • Features

Solutions

  • Plans and pricing
  • For universities
  • For business
  • For government

Resources

  • Templates
  • User docs and LaTeX learning
  • Blog

© Overleaf

On this page
  • Should I update MongoDB?
  • Checking your MongoDB version
  • Update process
  • Upgrading MongoDB
  • Update instructions when running MongoDB outside Docker

Was this helpful?

Export as PDF
  1. Maintenance

Updating MongoDB

PreviousS3 migrationNextUser management

Last updated 3 months ago

Was this helpful?

Any new release of Server CE/Server Pro will indicate any change on the supported version of MongoDB in its .

Should I update MongoDB?

You should only consider updating your MongoDB version if you're planning to upgrade your instance of Server CE/Server Pro.

If you're running a MongoDB version that is newer than the recommended for your current (or target) version there's no need to make any changes.

You should never downgrade your MongoDB version.

If you experience a specific problem that you think might be related to your current version of MongoDB, feel free to if you are a Server CE user or contact Overleaf Support if you are Server Pro a user.

Checking your MongoDB version

Opening the mongo shell should immediately print the current version.

Overleaf Toolkit users:

bin/docker-compose exec mongo mongod --version
db version v5.0.24
Build Info: {
    "version": "5.0.24",
    "gitVersion": "f034f0c51b3dffef4b8c9452d77ede9888f28f66",
    "openSSLVersion": "OpenSSL 1.1.1f  31 Mar 2020",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "ubuntu2004",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

Docker Compose users:

docker compose exec mongo mongod --version
db version v5.0.24
Build Info: {
    "version": "5.0.24",
    "gitVersion": "f034f0c51b3dffef4b8c9452d77ede9888f28f66",
    "openSSLVersion": "OpenSSL 1.1.1f  31 Mar 2020",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "ubuntu2004",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

Update process

Updating the version of MongoDB during an upgrade of your Server CE/Server Pro instance is as follows:

  1. Decide the version of Server CE/Server Pro you plan to upgrade to.

  2. Find the version of MongoDB recommended by that specific Overleaf Server CE/Server Pro release.

  3. Follow the instructions to upgrade MongoDB to the target version.

  4. Upgrade Server CE/Server Pro image version and restart the instance.

Our recommendation is to always upgrade Server CE/Server Pro to the latest version available, since it's always guaranteed to be supported (Server Pro users only). In case you decide to go to an earlier version, this table shows the recommended version of MongoDB for earlier releases of Server CE/Server Pro, but you should never downgrade your MongoDB version.

Server CE/Server Pro
MongoDB Version

2.0.x

3.4

2.1.x to 2.4.x

3.6

>=2.5.0

4.0

>=3.1.0

4.2

>=3.2.0

4.4

>=4.2.0

5.0

>=5.1.0

6.0

Upgrading MongoDB

MongoDB requires step-by-step upgrades. That means you can't go straight from, let's say 4.0 to 5.0. You need first to update 4.2 to 4.4, and then 5.0.

MongoDB uses even numbers for their stable versions.

Update instructions when running MongoDB outside Docker

Note that the instructions for 5.0 point to a replica set install, instead of standalone. As Server Pro/CE 4.0.1+ uses transactions, MongoDB needs to be run as a replica set.

Toolkit users

Update MONGO_VERSION, e.g. MONGO_VERSION=6.0

Docker Compose users

Update the version of the mongo image tag, e.g. services -> mongo -> image:mongo:6.0;

In most cases the update just requires setting up a compatibility setting before actually updating the version. Let's see an example.

Example: Upgrading MongoDB from 5.0 to 6.0

Let's start by making sure we're running MongoDB 5.0:

Overleaf Toolkit users:

bin/docker-compose exec mongo mongod --version
# db version v5.0.24

Docker Compose users:

docker compose exec mongo mongod --version
# db version v5.0.24

Overleaf Toolkit users:

bin/mongo
# MongoDB shell version v5.0.24
# ...
# overleaf:PRIMARY> db.adminCommand( { setFeatureCompatibilityVersion: "5.0" } )
# { 
# "ok" : 1,
# ...
# }
overleaf:PRIMARY> exit
# bye

Docker Compose users can run docker compose exec mongo mongosh to get a shell and run the same commands as Toolkit users.

Overleaf Toolkit users:

We'll then stop Server CE/Server Pro and MongoDB instances using the bin/stop command, set MONGO_VERSION=6.0 in config/overleaf.rc, and then restart the mongo service using bin/up mongo) to verify the update went smoothly.

Finally, we'll update the Server CE/Server Pro image version to our target version and recreate all the services using the bin/up -d command.

Docker Compose users:

Finally, we'll update Server CE/Server Pro image version to our target version and recreate all services using the docker compose up command.

You can view the end-of-life status for each version of MongoDB .

According to the , the only requirement is to have featureCompatibilityVersion set to 5.0. We do so by opening a MongoDB shell and running the indicated command:

We'll then stop Server CE/Server Pro and MongoDB instances using the docker compose down command, update file to use image: mongo:6.0, and then restart the mongo service using the docker compose up mongo command to verify the update went smoothly.

release notes
raise an issue
here
From 3.2 to 3.4
From 3.4 to 3.6
From 3.6 to 4.0
From 4.0 to 4.2
From 4.2 to 4.4
From 4.4 to 5.0
From 5.0 to 6.0
upgrade instructions
docker-compose.yml