Skip to content

Document which Mongo update fields count as explicitly set for update defaults #30467

Open

Description

@wmadden-electric

What a user sees. On MongoDB, an update default (temporal.updatedAt(), onUpdate: now) is skipped for a field the update sets explicitly. Mongo counts every top-level field the update document touches as explicit, whatever the operator: $set, $unset, $inc, $push. An update made only of operators other than $set still counts as non-empty and gets its defaults. SQL counts only $set-style assignments. The subsystem doc says "a field the write sets explicitly keeps its value" and "an update whose payload touches no field gets no generated values", but does not say which operators count, or that the rule differs from SQL.

Where. docs/architecture docs/subsystems/10. MongoDB Family.md (the execution defaults section) and the prisma-8 skill's contract reference; the behaviour lives in the Mongo ORM's update path in packages/2-mongo-family/5-query-builders/orm/src/collection.ts.

Likely fix. Add a sentence to both docs listing the operators that make a field explicit on MongoDB, next to the SQL rule, with one example per operator family.

Where it came from. #30403; the note was meant to land when the default runtime moved into the framework in #30406.

Activity

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