Registry / testing / mongodb-memory-server-percona

mongodb-memory-server-percona

JSON →
library0.1.1jsnpmunverified

Drop-in replacement for mongodb-memory-server that downloads and runs Percona Server for MongoDB with the open-source inMemory storage engine. Version 0.1.1 supports linux/x64 only (per Percona binary tarballs), requires Node >=20, and peer depends on mongodb ^6.0.0 and mongodb-memory-server-core >=10 <12. It automatically fetches Percona binaries (~440 MB on disk) on first use, caches them, and fixes ABI-incompatible libldap/libssl by staging a wrapper with correct LD_LIBRARY_PATH. Key differentiator: unlike mongodb-memory-server (which only ships WiredTiger with Community builds), this gives you an open-source inMemory engine (10-40% faster writes, no journal) that MongoDB Enterprise normally restricts. Matches the full mongodb-memory-server API and ships TypeScript types.

npm install mongodb-memory-server-percona
INSTALL
IMPORT
SIG · MONGODB-MEMORY-SER
M
mongodb-memory-server-percona
testingjavascriptv0.1.1
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.

MongoMemoryServer
import { MongoMemoryServer } from 'mongodb-memory-server-percona'
import { MongoMemoryServer } from 'mongodb-memory-server'
Package is a drop-in replacement, but must be imported from this package, not mongodb-memory-server, to use Percona binary.
MongoMemoryServer
import { MongoMemoryServer } from 'mongodb-memory-server-percona'
const MongoMemoryServer = require('mongodb-memory-server-percona')
Package is ESM-only and does not support CommonJS require(). Note: require() may work with some bundlers but is not officially supported.
MongoMemoryServer (type)
import type { MongoMemoryServer } from 'mongodb-memory-server-percona'
TypeScript types are exported; use type-only import for type checking without runtime import.

Creates a Percona Server for MongoDB instance in memory using the default version (8.0.20-8), prints its connection URI, and stops it.

import { MongoMemoryServer } from 'mongodb-memory-server-percona'; async function quickStart() { // Create an in-memory Percona Server for MongoDB instance const server = await MongoMemoryServer.create(); const uri = server.getUri(); console.log('MongoDB URI:', uri); // Use the URI with mongoose or mongodb driver // const mongoose = require('mongoose'); // await mongoose.connect(uri); // ... tests ... await server.stop(); } quickStart().catch(console.error);
Debug
Known issues
breakingPackage name is 'mongodb-memory-server-percona', not 'mongodb-memory-server' – importing from the wrong package will use the regular MongoDB Community binary (WiredTiger) instead of Percona inMemory.
fix
Ensure import is from 'mongodb-memory-server-percona'.
affects: >=0.0.0
gotchaThe fetch step must be run before first usage (via npx mongodb-memory-server-percona-fetch or autoFetch:true). If autoFetch is false and binary not cached, server creation will throw.
fix
Run `npx mongodb-memory-server-percona-fetch` prior to test run, or ensure `autoFetch: true` in options.
affects: >=0.0.0
gotchaOnly linux/x64 is supported – the package will fail on macOS or Windows because Percona only publishes tarballs for linux/x64.
fix
Use Docker or a CI environment with linux/x64 runners for tests that require Percona.
affects: >=0.0.0
deprecatedThe perconaVersion option may change default in future releases; currently defaults to 8.0.20-8.
fix
Always specify an explicit version if relying on a specific release.
affects: <1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'mongodb-memory-server-percona'
Package not installed or not found in node_modules.
fix
Run `npm install --save-dev mongodb-memory-server-percona`.
Error: fetchBinary: unable to download Percona archive
Network issue or missing internet access; or PSMDB_BASE_URL misconfigured.
fix
Check internet connectivity, ensure PSMDB_BASE_URL is correct (if set), or manually place binary in cache directory.
TypeError: MongoMemoryServer.create is not a function
Import is from wrong package (e.g., 'mongodb-memory-server') where create exists but returns different constructor.
fix
Change import to 'mongodb-memory-server-percona'.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
mongodbrequiredPeer dependency for connecting to the server
mongodb-memory-server-corerequiredPeer dependency providing core mongod management logic
Agent activity
11 hits · last 30 days
node
10
Resources
mongodb-memory-server-percona — npm install mongodb-memory-server-percona · libregistry