{"id":48577,"library":"mongo-migration","title":"mongo-migration","description":"mongo-migration (v0.0.3) is a lightweight MongoDB migration tool for Node.js, designed for simple schema and data migrations. It uses MongoDB driver v3 and focuses on file-based migration management with support for adding migration files and tracking executed migrations in a dedicated collection. Notable features include migration cleanup to synchronize the database state with existing migration files. This package is minimal and unopinionated, suitable for small projects, but lacks advanced features like rollback, CLI, or TypeScript types. Development appears to be early-stage with no recent releases.","status":"active","version":"0.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/sakulstra/mongo-migration","tags":["javascript","mongodb","migration"],"install":[{"cmd":"npm install mongo-migration","lang":"bash","label":"npm"},{"cmd":"yarn add mongo-migration","lang":"bash","label":"yarn"},{"cmd":"pnpm add mongo-migration","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for MongoDB driver v3","package":"mongodb","optional":false}],"imports":[{"note":"ESM import is recommended. CommonJS require may still work but is not documented.","wrong":"const Migration = require('mongo-migration');","symbol":"Migration","correct":"import { Migration } from 'mongo-migration'"},{"note":"Destructure the named export in CommonJS.","wrong":"const mongoMigration = require('mongo-migration'); const Migration = mongoMigration.Migration;","symbol":"Migration","correct":"const { Migration } = require('mongo-migration')"},{"note":"No default export exists; only named export Migration.","wrong":"const mongoMigration = require('mongo-migration').default","symbol":"default export","correct":"import mongoMigration from 'mongo-migration'"}],"quickstart":{"code":"import { Migration } from 'mongo-migration';\nimport path from 'path';\n\nconst config = {\n  url: process.env.MONGO_URL ?? 'mongodb://localhost:27017',\n  database: 'myapp',\n  migrationCollection: 'migrations'\n};\n\nconst migration = new Migration(config);\nmigration.addFile(path.join(__dirname, './migrations/001-initial.js'));\nmigration.addFile(path.join(__dirname, './migrations/002-add-indexes.js'));\n\nasync function run() {\n  const result = await migration.migrate();\n  console.log('Migrations executed:', result);\n}\n\nrun().catch(console.error);","lang":"typescript","description":"Shows how to create a Migration instance, add migration files, and run migrations using async/await. Requires MongoDB connection URL and database name."},"warnings":[{"fix":"Consider switching to Renovate or Dependabot for automated dependency updates.","message":"Greenkeeper badge present in README indicates outdated dependency monitoring integration.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Manually write reverse migration scripts and execute them separately if needed.","message":"Missing migration rollback or down functionality. Migrations cannot be reverted automatically.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Create a .d.ts file or use // @ts-ignore.","message":"No TypeScript type definitions provided. Using in TypeScript projects may require custom type declarations.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure mongodb package version ^3.x is installed. For MongoDB 5+, consider alternative migration tools.","message":"Uses MongoDB driver v3 which may be incompatible with MongoDB 5+ or newer driver versions.","severity":"breaking","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'ad':39 'advanc':76 'appear':85 'base':33 'cleanup':54 'cli':80 'collect':49 'data':21 'databas':58 'dedic':48 'design':16 'develop':84 'driver':26 'earli':89 'early-stag':88 'execut':44 'exist':61 'featur':51,77 'file':32,41,63 'file-bas':31 'focus':29 'includ':52 'javascript':95 'lack':75 'lightweight':10 'like':78 'manag':35 'migrat':3,6,12,22,34,40,45,53,62,97 'minim':67 'mongo':2,5 'mongo-migr':1,4 'mongodb':11,25,96 'node.js':15 'notabl':50 'packag':65 'project':73 'recent':93 'releas':94 'rollback':79 'schema':19 'simpl':18 'small':72 'stage':90 'state':59 'suitabl':70 'support':37 'synchron':56 'tool':13 'track':43 'type':83 'typescript':82 'unopinion':69 'use':24 'v0.0.3':7 'v3':27","created_at":"2026-06-07T16:57:21.517774+00:00","updated_at":"2026-06-07T16:57:21.517774+00:00","problems":[{"fix":"Run: npm install mongo-migration","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'mongo-migration'"},{"fix":"Use: import { Migration } from 'mongo-migration'","cause":"Incorrect import: using default import instead of named import.","error":"Migration is not a constructor"},{"fix":"Include username and password in the URL, e.g., mongodb://user:pass@localhost:27017","cause":"Missing or incorrect credentials in MongoDB URL.","error":"MongoError: Authentication failed"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/sakulstra/mongo-migration#readme","github":"https://github.com/sakulstra/mongo-migration","docs":null,"changelog":null,"pypi":null,"npm":"mongo-migration","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}