For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.

Access MongoDB Binaries Through Stable Paths

The MongoDB Agent downloads MongoDB Server, mongosh, and MongoDB Database Tools binaries into version-specific directories under the download directory. The default download directory is /var/lib/mongodb-mms-automation. Version-specific paths change each time the agent downloads a new version.

To provide a stable path to these binaries, the agent maintains the following symbolic links in the download directory:

Symlink name
Target directory
Symlink path

mongodb

The bin directory of the highest MongoDB Server version installed on the host

/var/lib/mongodb-mms-automation/mongodb

mongosh

The bin directory of the MongoDB Shell version that Ops Manager manages

/var/lib/mongodb-mms-automation/mongosh

mongodb-tools

The bin directory of the MongoDB Database Tools version that Ops Manager manages

/var/lib/mongodb-mms-automation/mongodb-tools

The examples use the default download directory on Linux and macOS: /var/lib/mongodb-mms-automation. On Windows, the default download directory is C:\MMSAutomation\versions. For example, call mongosh through C:\MMSAutomation\versions\mongosh. If you use a different download directory, change the path prefix to match.

The symlinks resolve to version-specific directories under the download directory. These directories follow the naming patterns:

  • MongoDB Server: mongodb-<platform>-<arch>-<version>, for example mongodb-linux-x86_64-7.0.14-ent

  • MongoDB Shell: mongosh-<platform>-<arch>-<version>, for example mongosh-linux-x86_64-2.2.4

  • MongoDB Database Tools: mongodb-database-tools-<platform>-<arch>-<version>, for example mongodb-database-tools-linux-x86_64-100.10.0

The agent manages the symlinks automatically. You do not create or update them yourself.

  • When the agent downloads a new version of a component, it updates that component's symlink to point to the new version. The update applies to upgrades and downgrades.

  • The mongodb symlink points to the highest MongoDB Server version installed on the host. When the agent removes the highest version, the symlink points to the highest version that remains.

  • The agent regularly checks the symlinks. If a symlink is missing or points to the wrong directory, the agent recreates it. The set of symlinks is correct only when every configured symlink is valid.

  • If a file or an empty directory exists at a symlink's path, the agent replaces it with the symlink.

  • Feature compatibility version changes do not affect the symlinks.

Earlier agent versions maintained a single symlink named bin in the download directory. It pointed to the bin directory of the MongoDB Shell version that Ops Manager manages. Starting with MongoDB Agent 108.0.29.9148-1 and 109.0.3.9449-1, which ship with Ops Manager 8.0.29 and 9.0.3, the agent maintains the stable symlinks instead.

Important

The agent no longer creates or updates the bin symlink. An existing bin symlink remains in place, but after a MongoDB Shell upgrade it can point to an older version or to a version that the agent removed. Update your scripts to use the new stable symlinks.

If your scripts call MongoDB binaries through version-specific paths or through the legacy bin symlink, update them one time to use the stable symlinks. After this change, the scripts continue to work through upgrades and downgrades.

1

Search your scripts for references to the bin symlink or to a version-specific directory under the download directory.

2

The following example shows a script before and after the change:

#!/bin/bashMMS=/var/lib/mongodb-mms-automation # Uses the bin symlink, which the agent# no longer updates$MMS/bin/mongosh "$MONGODB_URI" \ --eval 'db.adminCommand({ ping: 1 })' # Uses version-specific paths, which break# when Ops Manager upgrades the version$MMS/mongodb-database-tools-linux-x86_64-100.20.1/bin/mongodump \ --uri "$MONGODB_URI" \ --out "/backups/$(date +%F)"$MMS/mongodb-linux-x86_64-9.0.7-ent/bin/mongod \ --version

After the change, the same script uses the stable symlinks:

#!/bin/bashMMS=/var/lib/mongodb-mms-automation $MMS/mongosh/mongosh "$MONGODB_URI" \ --eval 'db.adminCommand({ ping: 1 })'$MMS/mongodb-tools/mongodump \ --uri "$MONGODB_URI" --out "/backups/$(date +%F)"$MMS/mongodb/mongod --version

The mongodb symlink points to the highest MongoDB Server version installed on the host, which might not be the version your script requires. To call a specific version, use that version's directory under the download directory.

If scripts or deployments fail after an upgrade, check the state of the symlinks in the download directory.

Symptom
Likely Cause
Resolution

Ops Manager does not finish applying changes to a deployment, and the agent log shows an error creating a symlink

A non-empty directory with the same name as a symlink exists in the download directory

Move or remove that directory. The agent then creates the symlink.

The mongosh or mongodb-tools symlink is missing

Ops Manager does not manage that component on the host

None. Use the path of your local installation instead.

To change the download directory, see Configure Deployment to Have Limited Internet Access.