ObjectId Conversion Scope
ObjectId auto-conversion is enabled by default for the MongoDB runtime. It lets common identifier inputs work in query and write paths while keeping MongoDB values stored as real ObjectId values.
What Is Converted
monSQLize checks the runtime value shape, not dependency release numbers. If a value is already an ObjectId, it is reused. If an object looks like an ObjectId from another BSON implementation, monSQLize rebuilds it from its hexadecimal string.
Field Scope
Auto-conversion runs through normalized query filters and write documents. A valid 24-character hex string can be converted wherever the configured path is allowed.
If your data contains business strings that merely look like ObjectIds, exclude those fields:
Use autoConvertObjectId: false only when you want to pass every identifier value exactly as provided.
Query Examples
Both examples are normalized to ObjectId values before reaching MongoDB.
Write Examples
ObjectId-like values inside insert and update payloads are normalized before the write operation is sent.
Extended JSON Input
Extended JSON is a transport format, not the recommended in-memory shape for monSQLize operations. Do not pass this object when you mean _id should be an ObjectId:
Parse Extended JSON first, or create the ObjectId directly: