Skip to content

Conversation

@Cioraz
Copy link

@Cioraz Cioraz commented Sep 22, 2025

Description

This PR improves the MongoDB query builder by allowing it to accept any type for field values. It also safely converts 24-character _id strings to primitive.ObjectID, ensuring queries work correctly with MongoDB’s ObjectID fields.

Fixes #434

Type of change

  • Accepts values of type any in query builder
  • Converts valid _id strings to ObjectID
  • Handles nil and other basic types safely
  • Tested with sample MongoDB queries

How Has This Been Tested?

  • Scenario A
  • Scenario B

Note

Make MongoDB filter condition value handling accept any type with safe coercion (nil, ObjectID, bool, dates, ints, floats) instead of string-only parsing.

  • MongoDB driver:
    • Filter value parsing: Update drivers/mongodb/internal/backfill.go buildMongoCondition to accept any and convert values by type (handle nil, quoted strings, _id as ObjectID, booleans, dates, int64, float64; pass through bool/int32/int64/float64/time.Time).

Written by Cursor Bugbot for commit 17de27b. This will update automatically on new commits. Configure here.

@Cioraz Cioraz changed the title feat: add type-safe value conversion for MongoDB queries fix: add type-safe value conversion for MongoDB queries Sep 22, 2025
@CLAassistant
Copy link

CLAassistant commented Sep 29, 2025

CLA assistant check
All committers have signed the CLA.

@ImDoubD-datazip
Copy link
Collaborator

@Cioraz Hi, can you provide a video of your testing this, like all the possible cases which can occur in this case for mongodb

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.

fix: take val as any type in mongodb

4 participants