You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mongo ORM: create() returns _id null when the client uses forceServerObjectId #30517
What a user sees. With forceServerObjectId: true on the Mongo client, the server generates _id, so the ORM does not know it when building the value create() returns. create() returns _id: null (typed as a string); before, it returned no _id at all. Neither is the stored id.
Likely fix. When forceServerObjectId is set, read the inserted document back by a client-known key, or refuse the option with an error that says why; add a test with the option set.
Found by review of the fixes for the Mongo defaults, codecs and Prisma 6 source project's manual QA.
Hello! I’d like to contribute to this issue as my first contribution to Prisma ORM.
I’m planning to investigate why create() returns _id: null when forceServerObjectId: true is enabled and add a regression test.
Before I start implementing a fix, could you advise which approach you’d prefer: fetching the inserted document to retrieve its server-generated ID or rejecting this option with a clear error?
Activity
fix(mongo): every value the ORM writes, reads or filters on goes thro…
chrisfonseca8 commentedon Oct 2, 2026
Hello! I’d like to contribute to this issue as my first contribution to Prisma ORM.
I’m planning to investigate why
create()returns_id: nullwhenforceServerObjectId: trueis enabled and add a regression test.Before I start implementing a fix, could you advise which approach you’d prefer: fetching the inserted document to retrieve its server-generated ID or rejecting this option with a clear error?
Thank you!