Registry / database / mms
library0.1.7jsnpmunverified

MMS is a MongoDB migration tool that uses the native mongo shell for execution, ensuring compatibility with MongoDB's own scripting language. Version 0.1.7 is the current stable release, with infrequent updates and a small user base. It differentiates from other migration tools like db-migrate or node-pg-migrate by tightly coupling with the mongo shell, which allows for native MongoDB queries and commands, but restricts usage to environments where the mongo shell is available. The tool provides basic commands: create, migrate, rollback, and status, and uses configuration-driven migration files. It is suitable for teams already standardized on mongo shell scripts.

npm install mms
INSTALL
IMPORT
SIG · MMS
M
mms
databasejavascriptv0.1.7
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 (mms)
import mms from 'mms'
const mms = require('mms')
The package does not export a specific module; it is a CLI tool. Importing as shown is for illustrative consistency, but actual usage is via command line: npx mms create

Demonstrates creating a migration file and running it against a MongoDB instance using the mongo shell.

// Initialize a migration npx mms create my-migration // Output file: migrations/20250301000000-my-migration.js // Edit the file with your mongo shell script // Run migrations npx mms migrate --uri 'mongodb://localhost:27017/mydb' // Check status npx mms status --uri 'mongodb://localhost:27017/mydb'
Debug
Known issues
gotchaRequires the mongo shell (mongosh) to be installed and available on PATH.
fix
Install mongosh or ensure the mongo command is available.
affects: >=0.1
gotchaMigration scripts are executed via temporary files; ensure your OS supports temporary file creation.
fix
No action needed if using standard Node.js environment.
affects: >=0.1.6
deprecatedUses bluebird for promises, which is deprecated in favor of native promises.
fix
No fix needed; the library uses bluebird internally, but this does not affect user code.
affects: >=0.1
gotchaOnly supports MongoDB connection strings via --uri flag; no support for environment variable overrides.
fix
Always pass --uri explicitly or set it in configuration.
affects: >=0.1
gotchaRollback is limited: it only rolls back the last step if migration fails, not a full undo of a migration.
fix
Manually write rollback scripts and use mms rollback command after a successful run.
affects: >=0.1.5
Errors
Common errors & fixes
mongo: command not found
Mongo shell is not installed or not in PATH.
fix
Install mongosh from MongoDB official site or ensure it is in your PATH.
Cannot find module 'mms'
Global installation missing or local node_modules not installed.
fix
Run 'npm install -g mms' for global CLI or 'npm install mms' locally.
Error: ENOENT: no such file or directory, open '.../migrations/...'
Migration directory does not exist or path is invalid.
fix
Create a 'migrations' directory in the project root or specify a custom path via config.
SyntaxError: Unexpected token
Invalid JavaScript syntax in migration file.
fix
Ensure migration files contain valid mongo shell script syntax (not Node.js).
Upgrade
Version history
0.1.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
packagemms
mms — npm install mms · libregistry