URL to always download the latest version of mongosh

I’m looking to automate always installing the latest available version of mongosh in a CI pipeline. I get that I can go to the downloads page here, pick the version, and the platform, and click “copy link”. That will give me a URL like this:


Well, what about when a new version comes out? I don’t want to have to update this URL in my CI pipeline every time a new version comes out. Is there a URL equivalent of this that I can use?:


Surely there must be a way to get the ‘latest’ rather than needing to specify a version. Any help would be greatly appreciated. Thanks!

Not a direct answer to your question, but what about using the mongodb yum/apt repo ?

I’m considering the distro package manager route, but Im trying to fit the mongosh install into an existing workflow that does a curl for the tarball, unzips it, and puts it in the PATH (among other things). So I’m trying to keep things consistent and distro-independent if I can.

I’ve figured out how to at least list all of the available versions from a particular repo - in this case Ubuntu Focal:

curl --silent https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/6.0/multiverse/binary-amd64/Packages | grep -A 5 -x "Package: mongodb-mongosh" | grep "Version:" | cut -d: -f 2 | sed 's/ //g' | sort -r

A bit ugly but it works. A drawback here is that this is the .deb repo that I’m finding the available versions from. There’s not guarantee that all of the same versions will exist for the tarballs (although I would assume the same versions will almost always exist between .deb and tarball)

There really, really should be a ‘linux’ (or ‘tarball’ or whatever) directory at this level so that the tarballs can be reached programatically:


Since there is a yum and apt equivalent:


If there is a URL for what I’m looking for, someone please let me know.

There is a good answer for mongod but not one I’ve found so far for mongosh.

If the CI is container based mongosh is already in the container image.