Registry / devops / mongodb-download-url

mongodb-download-url

JSON →
library1.8.13jsnpmunverified

A CLI and library to look up download URLs for MongoDB versions by platform, architecture, and debug builds. Current stable version 1.8.13 is maintained as part of the MongoDB DevTools Shared monorepo. It resolves version strings to official MongoDB download URLs, supporting semver-like version specs. Unlike manual parsing of MongoDB's download page, it programmatically handles version resolution across platforms (linux, osx, win) and architectures (x64, arm64).

npm install mongodb-download-url
INSTALL
IMPORT
SIG · MONGODB-DOWNLOAD-U
M
mongodb-download-url
devopsjavascriptv1.8.13
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import getMongoDBDownloadUrl from 'mongodb-download-url'
const getMongoDBDownloadUrl = require('mongodb-download-url')
Package exports a default function. CJS require works but ESM import is preferred since TypeScript types are provided.
getMongoDBDownloadUrl
const getMongoDBDownloadUrl = require('mongodb-download-url')
const { getMongoDBDownloadUrl } = require('mongodb-download-url')
The only export is the default function; destructuring will fail as there is no named export.
MongoDBDownloadUrlOptions
import type { MongoDBDownloadUrlOptions } from 'mongodb-download-url'
import { MongoDBDownloadUrlOptions } from 'mongodb-download-url'
Options type is exported as a named type for TypeScript usage; use import type to avoid runtime errors.

Shows how to use the default export to get a MongoDB download URL for a specific version, platform, and architecture.

import getUrl from 'mongodb-download-url'; async function main() { try { const url = await getUrl('6.0.0', { platform: 'linux', bits: 'x64' }); console.log('Download URL:', url); } catch (err) { console.error('Error:', err); } } main();
Debug
Known issues
gotchaThe first argument to the default function is a version string; 'stable' resolves to the latest stable MongoDB version, but may not be the latest patch release available on the download page.
fix
Use a specific semver version (e.g., '7.0.0') to get deterministic URLs.
affects: >=1.0.0
gotchaThe function returns a promise; forgetting to await or handle rejection will lead to unhandled promise rejections.
fix
Always await the call or use .then().catch().
affects: >=1.0.0
gotchaPlatform and bits options default to process.platform and process.arch; in Node.js on macOS process.platform is 'darwin' but the MongoDB download site uses 'osx' – this mismatch leads to errors.
fix
Explicitly pass platform: 'osx' when running on macOS.
affects: >=1.0.0
breakingVersion 1.2.0 changed the default version from 'latest' to 'stable'; code relying on 'latest' must be updated.
fix
Pass version: 'latest' explicitly if that behavior is desired.
affects: >=1.2.0
Errors
Common errors & fixes
Error: No download URL found for version 4.0.0 on darwin x64
Platform 'darwin' is not recognized; MongoDB uses 'osx'.
fix
Set platform: 'osx' in options.
TypeError: getMongoDBDownloadUrl is not a function
Using destructured import on a default export.
fix
Use import getMongoDBDownloadUrl from 'mongodb-download-url' or const getMongoDBDownloadUrl = require('mongodb-download-url').
UnhandledPromiseRejectionWarning: Error: Version 5.0.0 does not exist
The version string does not match any known MongoDB release.
fix
Check the version is correct and available on mongodb.com/download-center.
Upgrade
Version history
1.8.13latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
mongodb-download-url — npm install mongodb-download-url · libregistry