{"id":16345,"library":"east-mongo","title":"East MongoDB Adapter","description":"east-mongo is an adapter for the `east` Node.js database migration tool, specifically designed for MongoDB. It leverages the official `mongodb` native driver (peer dependency on versions 2.x.x or 3.x.x) to manage schema changes and data migrations. When migrations are executed, their names are recorded in a `_migrations` collection within the target database. The adapter provides helper functions like `dropIndexIfExists` and includes template options for promises-based or async/await migrations. This package, currently at version 1.0.0, appears to be abandoned, with no releases or significant activity since 2017, meaning it is not actively maintained and may have unpatched vulnerabilities or compatibility issues with modern MongoDB versions or Node.js runtimes. Its primary function is to provide the `db` instance from the native driver to migration scripts.","status":"abandoned","version":"1.0.0","language":"javascript","source_language":"en","source_url":"git://github.com/okv/east-mongo","tags":["javascript","database","db","migrate","mongo","mongodb"],"install":[{"cmd":"npm install east-mongo","lang":"bash","label":"npm"},{"cmd":"yarn add east-mongo","lang":"bash","label":"yarn"},{"cmd":"pnpm add east-mongo","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency as 'east-mongo' is an adapter for the 'east' migration tool.","package":"east","optional":false},{"reason":"Peer dependency for the MongoDB native driver, supporting versions 2.x.x or 3.x.x.","package":"mongodb","optional":false}],"imports":[{"note":"The adapter is loaded by `east` through its configuration file (`.eastrc`), not via direct JavaScript import statements. The value 'east-mongo' is a string reference to the installed package.","symbol":"Adapter Configuration","correct":"{ \"adapter\": \"east-mongo\" }"},{"note":"To use the async/await migration template, you reference its file path within the `.eastrc` configuration. This is a CommonJS `require.resolve` pattern, not an ES module import.","wrong":"import { async } from 'east-mongo/lib/migrationTemplates/async.js'","symbol":"Async Migration Template","correct":"require.resolve('east-mongo/lib/migrationTemplates/async.js')"},{"note":"The promises-based migration template is used by default if no 'template' path is specified in the `.eastrc` configuration.","symbol":"Promises Migration Template (Default)","correct":"// No explicit import needed if 'template' is not set in .eastrc"}],"quickstart":{"code":"/* .eastrc file */\nmodule.exports = {\n\t\"adapter\": \"east-mongo\",\n\t\"url\": \"mongodb://localhost:27017/my_database\",\n\t\"options\": {\n\t\t\"server\": {\n\t\t\t\"socketOptions\": {\n\t\t\t\t\"socketTimeoutMS\": 3600000\n\t\t\t}\n\t\t}\n\t}\n};\n\n/* Example migration file (e.g., 20230101000000-initial-setup.js) */\nexports.tags = [];\n\nexports.migrate = async function(params) {\n\tconst { db, dropIndexIfExists } = params;\n\n\t// Example: Create a collection and an index\n\tawait db.collection('users').createIndex({ email: 1 }, { unique: true });\n\tconsole.log('Created unique index on users.email');\n\n\t// Example: Insert some initial data\n\tawait db.collection('settings').insertOne({ key: 'appVersion', value: '1.0.0' });\n\tconsole.log('Inserted initial app version setting');\n\n\treturn Promise.resolve();\n};\n\nexports.rollback = async function(params) {\n\tconst { db, dropIndexIfExists } = params;\n\n\t// Example: Rollback by dropping the collection and index\n\tawait dropIndexIfExists('users', 'email_1'); // 'email_1' is the default index name\n\tawait db.collection('users').drop();\n\tconsole.log('Dropped users collection and index');\n\n\tawait db.collection('settings').deleteOne({ key: 'appVersion' });\n\tconsole.log('Removed app version setting');\n\n\treturn Promise.resolve();\n};","lang":"javascript","description":"This quickstart demonstrates how to configure `east-mongo` in an `.eastrc` file and provides a basic migration example using async/await functions for creating a collection, adding an index, inserting data, and a corresponding rollback function."},"warnings":[{"fix":"Ensure that `east` is installed at version >=1.0.0 and `mongodb` is installed at 2.x.x or 3.x.x (`npm install east@^1 east-mongo mongodb@^3`). For newer `mongodb` or `east` versions, consider using an alternative, more modern migration solution.","message":"This package is specifically designed for `east` version 1.x and `mongodb` native driver versions 2.x or 3.x. Using it with `east` versions prior to 1.x, or `mongodb` versions 4.x or newer, will likely lead to compatibility issues or errors.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"It is strongly recommended to find an alternative, actively maintained MongoDB migration tool. Continuing to use an abandoned package introduces significant security and stability risks to your application.","message":"The `east-mongo` package is abandoned, with no updates or activity since 2017. This means it will not receive bug fixes, security patches, or compatibility updates for newer Node.js versions, MongoDB server versions, or `mongodb` driver updates.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"If you must use `east-mongo`, run it in a Node.js 4.x, 6.x, or 8.x environment. For modern applications, migrate to an actively maintained migration tool compatible with current Node.js LTS releases.","message":"Node.js compatibility is limited to versions 4.0.0 and above. Running `east-mongo` on modern Node.js versions (e.g., Node.js 14, 16, 18, 20+) has not been tested and may encounter unexpected behavior or errors due to breaking changes in Node.js core.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Conduct a thorough security audit of your dependencies and codebase if using `east-mongo`. Prioritize migrating to a secure, actively maintained alternative to mitigate potential exploits.","message":"The package's Snyk badge indicates 'Known Vulnerabilities'. Given its abandonment, these vulnerabilities are likely unpatched, posing a security risk to applications using this package.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Install the peer dependency: `npm install mongodb@^3` (or `mongodb@^2` if preferred) in your project.","cause":"The 'mongodb' package, a peer dependency, was not installed alongside 'east-mongo'.","error":"Error: Cannot find module 'mongodb'"},{"fix":"Ensure 'east-mongo' is installed (`npm install east-mongo`) and that your `.eastrc` has `\"adapter\": \"east-mongo\"`.","cause":"The 'east-mongo' package itself is not installed, or the 'adapter' path in your `.eastrc` file is incorrect.","error":"Error: Adapter 'east-mongo' not found. Check your .eastrc configuration."},{"fix":"Verify your MongoDB connection URL and options in `.eastrc`. Ensure the MongoDB server is running and accessible. Consider adding more robust error handling and connection retry logic in your migration scripts, though the underlying driver version may be a limiting factor.","cause":"This often occurs with older MongoDB drivers when connection options or lifecycle management are not handled robustly, or when the MongoDB server is unavailable/restarts during operations.","error":"MongoError: Topology was destroyed"}],"ecosystem":"npm"}