MongoDB Error 66: Performing an update on the path _id would modify the immutable field

Update payload included `_id` with a different value.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.0.0
Identifier: MongoDB Error 66: Performing an update on the path _id would modify the immutable field Platform: MongoDB

Interactive Diagnostic Checklist

Safe Diagnostic Command:
Inspect update `$set` payload

Technical Explanation

Update payload included `_id` with a different value. Verified technical resolution: Strip `_id` from `$set` payloads before calling `updateOne`.

Worked Examples

  • Diagnostic check: Inspect update `$set` payload

Limitations & Assumptions

  • Confirm exact software version and execution layer before applying configuration changes in production.

Source References & Verification

Resource ID: err-mongo-immutable-field-66 · Independently verified: 2026-11-25

Related Resources