Skip to main content
Any new release of Ayakaleaf Pro will indicate any change on the supported version of MongoDB in its release notes.

Should I update MongoDB?

You should only consider updating your MongoDB version if you’re planning to upgrade your instance of Ayakaleaf 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 raise an issue.

Checking your MongoDB version

Opening the mongo shell should immediately print the current version. Overleaf Toolkit users:
Docker Compose users:

Update process

Updating the version of MongoDB during an upgrade of your Ayakaleaf Pro instance is as follows:
  1. Decide the version of Ayakaleaf Pro you plan to upgrade to.
  2. Find the version of MongoDB recommended by that specific Ayakaleaf Pro release.
  3. Follow the instructions to upgrade MongoDB to the target version.
  4. Upgrade Ayakaleaf Pro image version and restart the instance.
We recommend always upgrading to the latest version available.
When performing an upgrade of Ayakaleaf Pro, we recommend upgrading to the latest release of the deployed major version before upgrading to the latest release of the next major version. If your deployment is more than one major version behind latest, you will be required to perform a multi-stepped upgrade.For example, if you’re running 6.2.0, upgrade to 6.2.2 first, then to 6.3.2, see Upgrading your deployment.You should never skip versions (6.2.0 -> 6.3.2). If you are using the Toolkit, and are more than one major version behind latest, you must not use the bin/upgrade script as you will be need to perform a manual multi-stepped upgrade.
It is important to ensure that you take a consistent backup before every major version upgrade to enable you to roll back should you require it.

Version support information

In case you decide to go to an earlier version, this table shows the recommended version of MongoDB for earlier releases, but you should never downgrade your MongoDB version. The table lists Overleaf releases. Ayakaleaf Pro images start at 6.0.0: 6.0.0 needs MongoDB 6.0 or later, and 6.0.1 and later need MongoDB 8.0 or later with feature compatibility version 7.0. With an older MongoDB the container stops at startup.
Overleaf versionMongoDB VersionMinimum Feature Compatibility VersionMaximum Version Supported by Node.js Driver
2.0.x3.4--
2.1.x to 2.4.x3.6--
>=2.5.04.0--
>=3.1.04.2--
>=3.2.04.4--
>=4.2.05.0--
>=5.1.06.0--
>=5.3.16.05.08.0
>=5.5.06.06.08.0
>=6.0.08.07.08.0
The minimum feature compatibility version above is based on the corresponding MongoDB version recommend for use with the version of Overleaf shown. If you plan to use a higher version, MongoDB will have its own minimum requirement.
You can view the compatibility table that specifies the supported versions of the MongoDB Node.js driver for use with MongoDB here. You can view the end-of-life status for each version of MongoDB here.

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

Here are links to the update instructions from mongodb.com when upgrading MongoDB.
Instructions for 5.0 and higher point to a replica set install, instead of standalone. As Ayakaleaf Pro uses transactions, MongoDB needs to be run as a replica set.
Documentation for MongoDB 3.2 to 4.2 is now available via https://www.mongodb.com/docs/legacy/
Basic Instructions In most cases the update requires setting up a compatibility flag before actually updating the mongo version. The steps are as follows:
  1. Set the compatibility flag as described in MongoDB release notes (see the examples below).
  2. Then update the mongo image:
    1. Toolkit users Update MONGO_VERSION, e.g. MONGO_VERSION=6.0
    2. Docker Compose users Update the version of the mongo image tag,
      e.g. services -> mongo -> image: mongo:6.0;
Example: Upgrading MongoDB from 5.0 to 6.0 Let’s start by making sure we’re running MongoDB 6.0: Overleaf Toolkit users:
Docker Compose users:
According to the upgrade instructions, the only requirement is to have featureCompatibilityVersion set to 5.0. We do so by opening a MongoDB shell and running the indicated command: Overleaf Toolkit users:
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 Ayakaleaf 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 Ayakaleaf Pro image version to our target version and recreate all the services using the bin/up -d command. Docker Compose users: We’ll then stop Ayakaleaf Pro and MongoDB instances using the docker compose stop command, update docker-compose.yml 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. Finally, we’ll update Ayakaleaf Pro image version to our target version and recreate all services using the docker compose up command. Start by making sure that you’re running MongoDB 6.0 using the mongod --version commands above. According to the upgrade instructions, the only requirement is to have featureCompatibilityVersion set to 6.0. We do so by opening a MongoDB shell and running the command db.adminCommand({ setFeatureCompatibilityVersion: "6.0" }) . Overleaf Toolkit users:
We’ll then stop Ayakaleaf Pro and MongoDB instances using the bin/stop command, set MONGO_VERSION=7.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 Ayakaleaf Pro image version to our target version and recreate all the services using the bin/up -d command. Start by making sure that you’re running MongoDB 7.0 using the mongod --version commands above. According to the upgrade instructions, the only requirement is to have featureCompatibilityVersion set to 7.0. We do so by opening a MongoDB shell and running the command db.adminCommand({ setFeatureCompatibilityVersion: "7.0", confirm: true }). Note that this now requires an additional confirm: true parameter.
We’ll then stop Ayakaleaf Pro and MongoDB instances using the bin/stop command, set MONGO_VERSION=8.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 Ayakaleaf Pro image version to our target version and recreate all the services using the bin/up -d command.

Equivalent commands for docker compose users

For docker compose users, the equivalent command are:
  • docker compose exec mongo mongod --version to display the mongo version
  • docker compose exec mongo mongosh to start a mongo shell for admin commands
  • docker compose stop command to stop the server
  • Edit the docker-compose.yml file to use image: mongo:6.0 to upgrade the mongo version
  • docker compose up mongo to restart the mongo service and verify the update went smoothly
  • Edit the docker-compose.yml file to use image: sharelatex:VERSION to upgrade the image version
  • docker compose up to recreate all services.

Creating a custom role

In version 5.5.1, we introduced a startup check to verify the feature compatibility version for MongoDB. If your MongoDB database uses authentication (e.g., basic authentication), the sharelatex container might not start, displaying a “not authorized on admin to execute command” permission error. To resolve this, you can either create a new role in MongoDB and assign it to the user account used to access the database using the instructions below, or set ALLOW_MONGO_ADMIN_CHECK_FAILURES=true to allow the check to fail without preventing the deployment from starting.
This new role only grants permission to read cluster-wide MongoDB server parameters and could be reused for monitoring purposes,

Q&A

Answer: None. The oldest Ayakaleaf Pro image, 6.0.0, needs MongoDB 6.0, and 6.0.1 and later need MongoDB 8.0. To run Ayakaleaf Pro on an existing MongoDB 4.4, upgrade MongoDB one major version at a time (4.4 → 5.0 → 6.0 → 7.0 → 8.0) as described in Upgrading MongoDB, with a backup before each step.
Last modified on November 3, 2026