Skip to content

Conversation

@devin-ai-integration
Copy link

Phase 1: MongoDB Migration – Environment Setup & Dependencies

Summary

This PR implements Phase 1 of the MongoDB migration plan by adding MongoDB infrastructure and configuration alongside the existing DynamoDB setup without changing any application logic.

Changes:

  • Dependencies: Add pymongo>=4.0.0 to requirements.txt (kept boto3 and all existing deps).
  • Chalice config: Add MONGODB_URI to environment_variables for both local and dev stages.
  • Env docs: Add .env.example documenting MONGODB_URI and the existing API_ENDPOINT.
  • Helper script: Add test_mongodb_connection.py to validate local MongoDB connectivity end-to-end.

Out of scope by design: No changes to DynamoDB code and no changes to application code (e.g., app.py, chalicelib/ddb.py).

Review & Testing Checklist for Human

3–5 items

  • Validate the .chalice/config.json changes: confirm adding "MONGODB_URI" for both local and dev stages is desired (dev currently points to mongodb://localhost:27017—ok for local dev, but please confirm this is correct for your dev usage).
  • Install deps and sanity check: pip install -r requirements.txt should succeed cleanly with both boto3 and pymongo installed in your environment.
  • Ensure DynamoDB tests still pass when the environment is configured:
    • Set AWS_DEFAULT_REGION (e.g., export AWS_DEFAULT_REGION=us-east-1) and run DynamoDB Local per README.
    • Then run pytest -vv. The current NoRegionError appears to be a pre-existing environment variable issue, not introduced by this PR.
  • Confirm keeping test_mongodb_connection.py in repo is acceptable (it’s a local helper for validation only; I can move it under scripts/ or remove if not desired).
  • Optional: chalice local --stage local and verify that adding MONGODB_URI does not affect existing DynamoDB behavior.

Suggested test plan:

  1. Start MongoDB: sudo systemctl start mongod; ensure it listens on 27017.
  2. Validate Mongo: python test_mongodb_connection.py should report successful connection and read from chat.chat.
  3. DynamoDB Local: run per README, set export API_ENDPOINT=localhost and export AWS_DEFAULT_REGION=us-east-1.
  4. Run tests: pytest -vv.
  5. chalice local --stage local (optional) to confirm the app still behaves as before.

Notes

  • No application logic was altered; this is purely additive infra/config work to prepare for MongoDB migration while preserving the DynamoDB path.
  • I verified local MongoDB connectivity with pymongo and created the chat database and chat collection.
  • Existing tests currently error with NoRegionError, which is an environment configuration issue (missing AWS region) and appears unrelated to these changes.
  • Session: https://app.devin.ai/sessions/ce3c02b17d124a4bac404b0ce6fb2b18
  • Requested by: Abhay Aggarwal (@abhay-codeium)

Co-Authored-By: Abhay Aggarwal <abhay.aggarwal@codeium.com>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants