Skip to content

Mongo ORM: object-form where() is typed undefined for every field on a TypeScript-built contract #30513

Open

Description

@wmadden-electric

What a user sees. With a contract built by the Mongo TypeScript builder and passed straight to mongo({ contract }) (no emitted contract.d.ts), every field of the object-form filter is typed undefined. where({ title: 'x' }) and where({ _id }) fail to compile with "Type 'string' is not assignable to type 'undefined'". The runtime handles the query fine. Users have to fall back to MongoFieldFilter expressions.

Reproduces on rc.12 and on main at d13613775f. MongoWhereFilter and the no-emit mongo({ contract }) path date from April 2026.

Likely fix. Derive MongoWhereFilter's field types from the builder's contract type the same way the emitted contract.d.ts path does; add a type test on a TS-built contract.

Found while fixing manual-QA findings for the Mongo defaults, codecs and Prisma 6 source project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions