Registry / database / momy
library0.8.1jsnpmunverified

Momy is a command-line tool for replicating MongoDB collections to MySQL in real-time using MongoDB's Replica Set oplog. Version 0.8.1 is the latest stable release. It enables SQL queries on NoSQL data and access via Excel or Access. Key differentiators include support for field name normalization, dot-notation field mapping, and Docker deployment. It requires MongoDB Replica Set and MySQL setup, and uses a configuration file (momyfile.json) to define collections and field types.

npm install momy
INSTALL
IMPORT
SIG · MOMY
M
momy
databasejavascriptv0.8.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.

momy
npx momy
import momy from 'momy'
Momy is a CLI tool, not a library. Run via npx or global install.
configuration
Create a momyfile.json
Passing options via command line flags
Configuration is via a JSON file, not CLI flags except --config.
docker image
docker run cognitom/momy
using npm install -g inside docker
Official Docker image is available. Use volume mount for config.

Shows basic setup: create config, import existing data, then start streaming replication.

// 1. Create momyfile.json { "src": "mongodb://localhost:27017/mydb", "dist": "mysql://root:password@localhost:3306/mydb", "collections": { "users": { "_id": "string", "name": "string", "email": "string" } } } // 2. Import all data npx momy --config momyfile.json --import // 3. Start real-time replication npx momy --config momyfile.json
Debug
Known issues
gotchaMongoDB must be in Replica Set mode even if not replicating; rs.initiate() is required.
fix
Start mongod with --replSet rs0 --oplogSize 100, then run rs.initiate() in mongo shell.
affects: >=0.0.0
gotchaField name normalization with fieldCase changes _id to id, which may break existing queries.
fix
If using fieldCase, update any references to use 'id' instead of '_id'.
affects: >=0.0.0
deprecatedThe --import flag may not work as expected with large datasets; no batching or progress indication.
fix
Consider using mongodump/mongorestore for initial load if data is large.
affects: >=0.8.0
Errors
Common errors & fixes
Error: connect ECONNREFUSED 127.0.0.1:3306
MySQL server not running or incorrect host/port in momyfile.json.
fix
Ensure MySQL is running and the connection URL in momyfile.json is correct.
MongoError: not master and slaveOk=false
MongoDB not in Replica Set mode or not initialized.
fix
Start mongod with --replSet rs0 and run rs.initiate() in mongo shell.
Error: Cannot find module 'momy'
Attempting to import momy as a Node.js module instead of using CLI.
fix
Use npx momy or install globally with npm install -g momy.
Upgrade
Version history
0.8.1latest on npm
Audit
Dependencies
mongodbrequiredMongoDB Replica Set must be running and accessible
mysqlrequiredMySQL server must be running and accessible
Agent activity
9 hits · last 30 days
node
6
Resources
packagemomy
momy — npm install momy · libregistry