VersionError: No matching document found for id MongoDB Origin: Data OSI layer 7 · Application Last updated 5 Nov 2026

Mongoose: VersionError: No matching document found for id "5f..." version 3 modifiedPaths "items"

Mongoose tried to save a document whose array was changed by someone else since you loaded it (optimistic concurrency).

Exact message you may see VersionError: No matching document found for id version modifiedPathsVersionError: No matching document found for id "5f"Mongoose VersionError No matching document foundNo matching document found for id version 3
Seen on: MongoDB Node.js

Meaning

Arrays use a version key __v. A save that modifies arrays after the doc changed elsewhere fails. Reload the document and retry, use atomic update operators ($push, $set) with updateOne instead of load-modify-save, or disable versioning for the schema (versionKey: false) if safe.

Common causes

  • Two requests modifying the same document array
  • Load-modify-save race
  • Stale document held in memory
  • Array element order changes
  • Retries replaying old versions

⚡ Quick fix

  1. Use updateOne({_id}, {$push: { items: item }})
  2. Reload and reapply the change
  3. Retry on VersionError

Detailed fix by platform

Node.js

  1. await Order.updateOne({ _id }, { $push: { items: item } });

How to diagnose

  1. Race — Concurrent writers?
  2. Update — Atomic operator possible?
  3. Retry — Implemented?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

ActiveRecord::StaleObjectError (optimistic locking) — Rails: ActiveRecord::StaleObjectError: Attempted to update a stale object: Order (Ruby / Rails)ActiveRecord::StaleOb…CastError: Cast to Date/Number/Boolean failed — Mongoose: CastError: Cast to date failed for value "abc" (type string) at path "createdAt" (MongoDB)CastError: Cast to Da…ConditionalCheckFailedException — ConditionalCheckFailedException: The conditional request failed (AWS)ConditionalCheckFaile…MissingSchemaError: Schema hasn't been registered for model — Mongoose: MissingSchemaError: Schema hasn't been registered for model "User". Use mongoose.model(name, schema) (MongoDB)MissingSchemaError: S…Mongoose ValidationError — ValidationError: User validation failed: email: Path `email` is required. (Node.js)Mongoose ValidationEr…Mongoose: Model.find() no longer accepts a callback — MongooseError: Model.find() no longer accepts a callback (MongoDB)Mongoose: Model.find(…MongoParseError: options usenewurlparser / useunifiedtopology not supported — MongoParseError: option usenewurlparser is not supported (MongoDB)MongoParseError: opti…OverwriteModelError: Cannot overwrite model once compiled — Mongoose: OverwriteModelError: Cannot overwrite `User` model once compiled. (MongoDB)OverwriteModelError: …VersionEr…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.