{"id":27154,"library":"mongodb-migrations","title":"MongoDB Migrations","description":"A database migration tool for MongoDB, providing a simple way to manage and apply schema/data migrations. Current version 1.3.1 is stable but appears to have no recent updates (last release 2018).","status":"maintenance","version":"1.3.1","language":"python","source_language":"en","source_url":"https://github.com/DoubleCiti/mongodb-migrations","tags":["mongodb","migrations","database","cli"],"install":[{"cmd":"pip install mongodb-migrations","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for MongoDB connection","package":"pymongo","optional":false},{"reason":"Used by the CLI tool for shell commands","package":"sh","optional":true}],"imports":[{"note":"Connection is in the cli module, not top-level","wrong":"from mongodb_migrations import Connection","symbol":"Connection","correct":"from mongodb_migrations.cli import Connection"},{"note":"","wrong":"","symbol":"Migration","correct":"from mongodb_migrations.migration import Migration"}],"quickstart":{"code":"pip install mongodb-migrations\n# Create a migration directory\nmkdir -p migrations\n# Create a migration file\ncat > migrations/001_add_index.py << 'EOF'\nfrom mongodb_migrations.migration import Migration\n\nclass Migration001(Migration):\n    def upgrade(self):\n        self.db.users.create_index('email', unique=True)\nEOF\n# Run CLI (ensure MongoDB is running and credentials are set via env or config)\nmongo-migrate run --migrations-dir=./migrations --uri='mongodb://localhost:27017/mydb'","lang":"python","description":"Initialize migrations, create a sample migration, and run it."},"warnings":[{"fix":"Consider alternatives like mongodb-migrate, migrate-mongo, or write custom migration scripts.","message":"The project is unmaintained since 2018. It may not support newer versions of PyMongo (>=4.0) or MongoDB (>=5.0). Expect breaking changes with asynchronous drivers or modern connection URIs.","severity":"breaking","affected_versions":">=1.3.1"},{"fix":"Always implement downgrade methods and use --rollback explicitly.","message":"The 'down' method is not called automatically on rollback. You must implement 'downgrade' manually if needed.","severity":"gotcha","affected_versions":"all"},{"fix":"Use Python 3.6-3.7 or pin to older versions of dependencies.","message":"The CLI tool 'mongo-migrate' uses Python 2-style string formatting and may fail with Python 3.8+ under certain locale settings.","severity":"deprecated","affected_versions":"<=1.3.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install sh","cause":"The 'sh' package is a dependency but not installed automatically in all environments.","error":"pkg_resources.DistributionNotFound: The 'sh' distribution was not found"},{"fix":"Install pymongo==3.12.3: pip install pymongo==3.12.3","cause":"Older versions of the library import pymongo incorrectly or require pymongo <4.0.","error":"AttributeError: module 'pymongo' has no attribute 'MongoClient'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}