Registry / testing / mongodb-tools

mongodb-tools

JSON →
library1.0.6jsnpmunverified

A small utility library (v1.0.6, last release 2012) providing helper functions used internally for MongoDB driver testing. No active development; superseded by mongodb-memory-server and modern test harnesses. Differentiator: early tool for MongoDB test setup, now outdated.

npm install mongodb-tools
INSTALL
IMPORT
SIG · MONGODB-TOOLS
M
mongodb-tools
testingjavascriptv1.0.6
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.

MongoTools
const MongoTools = require('mongodb-tools');
import MongoTools from 'mongodb-tools';
This package provides a CommonJS module; no ES module or default export available. Use require().
startMongoD
const startMongoD = require('mongodb-tools').startMongoD;
const { startMongoD } = require('mongodb-tools');
Destructuring works, but the package exports individual functions on the module object.
stopMongoD
const stopMongoD = require('mongodb-tools').stopMongoD;
import { stopMongoD } from 'mongodb-tools';
ESM import is not supported; only CommonJS require.

Shows how to start and stop a MongoDB process using asynchronous callbacks.

const MongoTools = require('mongodb-tools'); // Start a MongoDB instance (uses mongod from PATH) MongoTools.startMongoD({ dbpath: '/tmp/mongodb-test' }, function(err, child) { if (err) throw err; console.log('MongoDB started with PID:', child.pid); // ... run tests ... // Stop the instance MongoTools.stopMongoD(child, function(err) { if (err) throw err; console.log('MongoDB stopped'); }); });
Debug
Known issues
deprecatedPackage is unmaintained since 2012. Use mongodb-memory-server or mongod binary directly.
fix
Replace with mongodb-memory-server for in-process MongoDB instances.
affects: >=1.0.0
breakingRequires mongod binary installed on system PATH; no embedded binary.
fix
Install MongoDB server separately or upgrade to mongodb-memory-server.
affects: >=1.0.0
gotchaCallbacks only; no Promise support.
fix
Wrap in Promise manually or use a modern library.
affects: >=1.0.0
gotchaDoes not clean up temp dbpath on errors; might leave stale lock files.
fix
Manually delete dbpath after tests.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'mongodb-tools'
Package not installed or global require path issue.
fix
Run 'npm install mongodb-tools' and ensure node_modules is correct.
TypeError: MongoTools.startMongoD is not a function
Using ES import syntax with this CommonJS-only package.
fix
Use 'const MongoTools = require('mongodb-tools');'
Error: spawn mongod ENOENT
MongoDB server binary not installed or not on PATH.
fix
Install MongoDB server and ensure mongod is accessible from shell.
Upgrade
Version history
1.0.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
mongodb-tools — npm install mongodb-tools · libregistry