Skip to content

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