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

find tool doesn't handle ObjectId fields correctly #6

Open
aboveaboutbelow opened this issue Jan 9, 2025 · 0 comments · May be fixed by #7
Open

find tool doesn't handle ObjectId fields correctly #6

aboveaboutbelow opened this issue Jan 9, 2025 · 0 comments · May be fixed by #7

Comments

@aboveaboutbelow
Copy link

aboveaboutbelow commented Jan 9, 2025

Issue

The find tool doesn't convert string values to ObjectId instances when querying MongoDB, causing queries on ID fields to return no results.

Current Behavior

  • String values in filter fields are not converted to MongoDB ObjectId instances
  • This affects any fields ending in "Id" or "_id" in queries
  • Queries using these fields return empty results even when matching documents exist

Expected Behavior

The find tool should automatically detect and convert string values that match the ObjectId format (24-character hex) in ID fields to proper MongoDB ObjectId instances.

Suggested Solution

Add automatic conversion for string values in fields ending with "Id" or "_id" that match the ObjectId format.

@aboveaboutbelow aboveaboutbelow changed the title find tool fails to handle ObjectId fields in queries find tool doesn't handle ObjectId fields correctly Jan 9, 2025
aboveaboutbelow added a commit to aboveaboutbelow/mongo-mcp that referenced this issue Jan 9, 2025
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 a pull request may close this issue.

1 participant