Skip to content

Mongo ORM: object-form where() rejects null and whole-list values #30514

Open

Description

@wmadden-electric

What a user sees. where({ name: null }) and where({ tags: ['a', 'b'] }) fail to compile, although the runtime supports both. MongoWhereFilter types each field as its codec's output type, which is never null for a nullable field and is the element type for a list field. where({ name: null }) is a common query for finding documents without a value.

Reproduces on main at d13613775f; the type dates from April 2026 or earlier.

Likely fix. Type a nullable field's filter value as T | null and a list field's as T[] (plus the element form if element matching is intended); add type tests for both.

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