Member Junction
    Preparing search index...
    Index

    Constructors

    Methods

    • Coerce a value for MongoDB when the target field is _id. Mongo's default _id is a 12-byte ObjectId, but MJ carries key/filter values as strings — so {_id: "507f..."} matches nothing. When the field is _id and the value is a 24-char hex string, wrap it as an ObjectId. All other fields and non-ObjectId _id shapes (e.g. a string _id) pass through unchanged. Shared by the driver's LoadSingle and this translator's comparison / IN paths so the behavior is uniform.

      Parameters

      • field: string
      • value: unknown

      Returns unknown

    • Coerce an ISO-8601 date-time string literal to a Date so range/equality comparisons match Mongo's native Date-typed fields (BSON compares across types by a fixed order, so a string never matches a Date). Without this, an incremental-sync watermark predicate like updatedAt >= '2026-03-01T…Z' silently matched ZERO documents.

      BEHAVIOR CHANGE / deliberate trade-off: a field that actually STORES an ISO-looking STRING no longer matches such a predicate — field >= '<iso>' previously compared string↔string lexicographically, and now the literal is a Date (which never equals a stored string). This is the mirror of the bug being fixed; native Date fields are far more common and a watermark predicate needs Date semantics, so a source that genuinely stores ISO strings must compare via RunNativeQuery (the escape hatch). A ZONELESS ISO string is interpreted as UTC (via parseIso8601AsUtc), never server-local. Date-only ('2026-03-01') and non-temporal strings pass through unchanged.

      Parameters

      • value: unknown

      Returns unknown