Registry / database / mongodb-migrations

mongodb-migrations

JSON →
library1.3.1pypypiunverified

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).

pip install mongodb-migrations
INSTALL
IMPORT
SIG · MONGODB-MIGRATIONS
M
mongodb-migrations
databasepythonv1.3.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.

Connection
from mongodb_migrations import Connection
from mongodb_migrations.cli import Connection

Initialize migrations, create a sample migration, and run it.

pip install mongodb-migrations # Create a migration directory mkdir -p migrations # Create a migration file cat > migrations/001_add_index.py << 'EOF' from mongodb_migrations.migration import Migration class Migration001(Migration): def upgrade(self): self.db.users.create_index('email', unique=True) EOF # Run CLI (ensure MongoDB is running and credentials are set via env or config) mongo-migrate run --migrations-dir=./migrations --uri='mongodb://localhost:27017/mydb'
mongodb-migrations --version
Debug
Known issues
breakingThe 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.
fix
Consider alternatives like mongodb-migrate, migrate-mongo, or write custom migration scripts.
affects: >=1.3.1
gotchaThe 'down' method is not called automatically on rollback. You must implement 'downgrade' manually if needed.
fix
Always implement downgrade methods and use --rollback explicitly.
affects: all
deprecatedThe CLI tool 'mongo-migrate' uses Python 2-style string formatting and may fail with Python 3.8+ under certain locale settings.
fix
Use Python 3.6-3.7 or pin to older versions of dependencies.
affects: <=1.3.1
Upgrade
Version history
1.3.1latest on PyPI · released May 13, 2024
Audit
Dependencies
pymongorequiredRequired for MongoDB connection
shoptionalUsed by the CLI tool for shell commands
Agent activity
2 hits · last 30 days
node
2
Resources
mongodb-migrations — pip install mongodb-migrations · libregistry