Remove mongodb backend#274
Conversation
|
Thanks for the pull request, @salman2013! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
taimoor-ahmed-1
left a comment
There was a problem hiding this comment.
Changes look good.
However, I would also suggest to drop the ENABLE_MYSQL_BACKEND waffle flag too in this PR.
|
@taimoor-ahmed-1 PR is available for review. Thanks |
|
Code changes look good. Can you also update README to remove all references to mongo backend and toggle. |
Summary
Remove the MongoDB backend from the openedx/forum service entirely. MySQL is now the only supported backend. All data migration tooling (MongoDB
→ MySQL commands, helpers, and tests) is preserved so operators can still migrate existing MongoDB data before fully decommissioning their
MongoDB deployment.
Motivation
openedx/public-engineering#424
What Was Removed
MongoDB backend package (forum/backends/mongodb/) — deleted entirely:
Backend routing logic (forum/backend.py) — simplified from conditional flag-based routing to always returning MySQLBackend:
Waffle flag (forum/toggles.py) — deleted. ENABLE_MYSQL_BACKEND CourseWaffleFlag and enable_mysql_backend_for_course() are no longer needed since
MySQL is always used.
MongoDB index creation command (forum/management/commands/forum_create_mongodb_indexes.py) — deleted. Only relevant when running MongoDB.
MongoDB-specific Elasticsearch import path (forum/search/es.py):
MongoDB-specific API routing (forum/api/threads.py, forum/api/comments.py):
MongoDB backend tests (tests/test_backends/test_mongodb/) — deleted entirely
MongoDB-specific thread view tests (tests/test_views/test_threads.py):
E2E docker-compose (tests/e2e/docker-compose.yml) — removed mongodb service block
Test fixtures (tests/conftest.py):
What Was Kept (Intentionally)
Migration commands (operators still need these to migrate existing MongoDB data):
MongoDB connectivity (needed by migration commands):
MongoContent MySQL model (forum/backends/mysql/models.py) — tracks MongoDB ObjectId → MySQL PK mappings used during migration; the corresponding
MongoContentAdmin in forum/admin.py is also kept
Migration tests (tests/test_management/test_commands/test_migration_commands.py) — all kept; only removed the patch_enable_mysql_backend fixture
that mocked the now-deleted enable_mysql_backend_for_course()
Key Code Changes
forum/search/es.py
forum/migration_helpers.py
forum/management/commands/forum_migrate_course_from_mongodb_to_mysql.py
Testing Impact
Ticket:
openedx/public-engineering#502