Skip to content
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

fix: auto-convert ObjectId strings in find tool filters (#6) #7

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

Conversation

aboveaboutbelow
Copy link

Fixes #6

Problem

When querying MongoDB through the find tool, string values in ID fields aren't being converted to ObjectId instances, causing queries to fail silently.

Solution

Added automatic detection and conversion of string values to ObjectId instances for ID fields (those ending with "Id" or "_id") when they match the ObjectId format. The conversion handles nested objects and includes error handling.

Testing

Manually verified with various ID fields and query combinations, confirming that:

  • String-to-ObjectId conversion works correctly
  • Mixed condition queries work
  • Nested objects are processed
  • Invalid strings are handled gracefully

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.

find tool doesn't handle ObjectId fields correctly
1 participant