A sub-package of mongodb-memory-server that automatically downloads a MongoDB 4.2 binary for testing purposes. Version 11.2.0 is current; releases follow mongodb-memory-server core with weekly or monthly cadence. It eliminates the need to manually manage mongod binaries for CI/CD and local test environments. Unlike mongodb-memory-server-core, this package includes the binary download as a postinstall step, making setup effortless. Supports TypeScript with bundled type declarations. Requires Node >=20.19.0 and is ESM-only since v9+. Key differentiator: pre-pinned version (4.2) avoiding version drift in tests.
npm install mongodb-memory-server-global-4.2No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an in-memory MongoDB 4.2 instance, outputs connection URI, and stops it.
Use named import: import { MongoMemoryServer } from 'mongodb-memory-server-core'Pass options as argument: await MongoMemoryServer.create({ instance: { port: 27017 } })Access mongod.uri instead of mongod.getUri() and mongod.dbName instead of mongod.getDbName()
Use await MongoMemoryServer.create() instead of new MongoMemoryServer()
Set HTTP_PROXY/HTTPS_PROXY environment variables or pre-download binary and set MONGOMS_SYSTEM_BINARY.
Upgrade Node.js to version 20.19.0 or later.
Remove these options; they are no longer needed.
Install mongodb-memory-server-core: npm install mongodb-memory-server-core
Use mongod.uri property instead.
Switch to ESM import (import { MongoMemoryServer } from 'mongodb-memory-server-core') or set type: module in package.json.Check internet connection, set proxy variables, or use MONGOMS_SYSTEM_BINARY to point to a pre-installed binary.
Use import { MongoMemoryServer } from 'mongodb-memory-server-core'