Skip to content

feat(index-check): add index check functionality before query #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Crushdada
Copy link

Summary

This PR adds a new indexCheck configuration option that enforces MongoDB queries to use indexes, preventing collection scans (COLLSCAN) operations.

Changes

  • ✅ Added indexCheck helper functions in src/helpers/indexCheck.ts
  • ✅ Updated 5 MongoDB operations to support index checking: deleteMany, aggregate, count, find, updateMany
  • ✅ Added configuration support in .smithery/smithery.yaml
  • ✅ Updated README.md with comprehensive documentation
  • ✅ Added comprehensive test suite with 7 passing tests

Features

  • Uses MongoDB's explain functionality to analyze query plans
  • Configurable via environment variables, CLI args, or platform config
  • Comprehensive error messages for debugging
  • Only applies to query operations (not inserts)

Testing

  • All existing tests pass
  • New unit tests achieve 57.89% code coverage
  • Integration tested with MCP server

Related Issues

Resolves #287

Documentation

  • Updated README.md with indexCheck configuration details
  • Added comprehensive examples and usage instructions
  • Updated .smithery/smithery.yaml following project patterns

@Crushdada Crushdada requested a review from a team as a code owner June 18, 2025 14:43
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.

[Feature Request]: Add index check before query
1 participant