Packages

mongoose

9.12.2 · 16 Nov 2026MIT9.5M / weekRepositoryHomepagenpmAtom feed

Upgrading mongoose From 5.13.23 to 9.12.0

345 releases in betweennotes for 281

Reading releases, release notes and advisories…

Other targets from 5.13.23Clears its 7 advisories6.13.12Latest9.12.2
6.0.0 has no release note on GitHub or in the repository's changelog, so its breaking changes are missing from the counts below.
  1. 5.13.23yours
  2. 6.0.0major
  3. 122 releases
  4. 7.0.0major
  5. 16 releases
  6. 7.3.3security
  7. 42 releases
  8. 8.0.0major
  9. 111 releases
  10. 9.0.0major
  11. 11 releases
  12. 9.2.2security
  13. 36 releases
  14. 9.12.0target
  15. 7 pre
54+
changes to make
7
advisories fixed
351+
new
830+
fixes

Counted from 281 of 345 release notes, and the breaking changes of 2 pre-releases on the way to a major. Advisories are counted from the advisory database, in full.

Before you upgrade

Tick each one off as you go
  • Breaking9.3.0
  • Breaking9.0.0
  • Breaking9.0.0
  • Breaking9.0.0
  • Breaking9.0.0
  • Breaking9.0.0
  • Breaking9.0.0
  • Breaking9.0.0
  • Breaking9.0.0
  • Breaking9.0.0

Security

Release by release

  1. 9.12.0

    4 Nov 20262 new · 1 fix
    • New

      Upgrade to mongodb driver 7.8 #16772 #16667

    • New

      Improve for document arrays: cache paths with defaults and schemas with select paths; avoid unnecessary $isModified() lookup #16595

    • Fixed

      array: Compare UUIDs by value in indexOf() so pull() and addToSet() work #16606 luantaraschi

  2. 9.11.4

    23 Oct 20265 fixes
    • Fixed

      Avoid walking into inherited properties like toString when hydrating documents, setting dotted paths, and merging updates

    • Fixed

      Only use own properties when looking up discriminators by key

    • Fixed

      schema: Disallow setting special properties via virtual()

    • Fixed

      query: Respect connection-level sanitizeFilter in queries

    • Fixed

      query: Disallow special properties like __proto__ as paths in where() and mod()

  3. 9.11.3

    21 Oct 20263 fixes
    • Fixed

      update: Honor overwriteImmutable in upserts and nested timestamps #16614 #15781 #8619 AbdelrahmanHafez

    • Fixed

      model: Stop Model.validate() crashing on missing nested objects #16600 NotAFlightRisk

    • Fixed

      connection: Don't disable autoIndex/autoCreate for a primary ReadPreference instance #16592 NgoQuocViet2001

  4. 9.11.2

    12 Oct 20262 new · 2 fixes
    • New

      Avoid applying saveSubdocs and sharding plugins to subdocuments #16585

    • New

      Upgrade to kareem@3.4.1 for mongoosejs/kareem#47 #16588

    • Fixed

      model: Cast array filter values in bulkWrite() #16574 #16573 OmBhandwaldar

    • Fixed

      schema: Allow function messages for number min/max and string minlength #16579 #16572 #8512 NotAFlightRisk

  5. 9.11.1

    7 Oct 20268 fixes
    • Fixed

      document: Call recursive toObject() when setting a path to a nested object #16571

    • Fixed

      update: Keep casting array filters after a path not in the schema #16558 giaBaoJS

    • Fixed

      document: Apply flattenDecimals when toObject() takes the shallow fast path #16569 #16568 jeremyml

    • Fixed

      query: Cast operators under $not inside $elemMatch on primitive arrays #16542 #13880 breken-ai

  6. 9.11.0

    5 Oct 20262 new · 1 fix
    • New

      Use MongoDB Node.js driver 7.7.x #16550

    • New

      query: Add Query.prototype.findAndCount() for composable paginated queries #16508 #16504 lokeshllkumar

    • Fixed

      Avoid double-calling validators on document arrays underneath nested paths #16484 #16291 #5411

  7. 9.10.4

    3 Oct 20265 fixes
    • Fixed

      Handle MongoDB server 9.x returning collation: { locale: 'simple' } on all indexes #16557

    • Fixed

      populate: Resolve dotted parent path when collecting deferred sub-populate children #16538 jfits

    • Fixed

      array: Compare dates by value in indexOf() so pull() removes them #16535 giaBaoJS

    • Fixed

      map: Register $set when Map#set() replaces an array #16540 #16539 luantaraschi

    • Fixed

      query: Cast case and then expressions in $expr $switch branches #16534 kwy404

  8. 9.10.3

    29 Sep 20265 fixes
    • Fixed

      model: Preserve unsaved documents after ordered bulkSave errors #16533 #16532 IbrahimHafez1

    • Fixed

      model: Don't mutate the caller's update object in bulkWrite updateMany #16526 fadiroot

    • Fixed

      schema: Run setters declared on the union path itself #16528 giaBaoJS

    • Fixed

      collection: Open collection if connection was already opened #16527 #16525 #16524

    • Fixed

      query+model: Replace {MODEL} in cast error messages from update and bulkWrite casting #16529 #16502 #16480

101 other lines we could not sort, mostly version bumps
  • types: Make MergeType more efficiently handle MergeType<A, {}> #16581 #16580

    9.11.2
  • types(schema): treat Int32 paths as number #16565 #16564 lazerg

    9.11.1
  • types(models): align UpdateOneModel and UpdateManyModel update typing with UpdateQuery #16559 #16545 aipd506

    9.11.1
  • types: Pass TLeanResultType into query for type narrowing support with lean() #16523 #16519

    9.11.0
  • types: Relax populate Model generics to allow typed virtuals to be passed to populate in TypeScript 7 with skipLibCheck #16503

    9.10.1
  • types(document): respect schema toObject and toJSON options #16431 #15594 samuelmbabhazi

    9.9.2
  • types: Import BSON from mongodb instead of bson #16434 #16434 orgads

    9.9.2
  • types: Respect the _id option when inferring StandardSchema types #16402

    9.8.1
  • types(model): keep Model.schema typed when TSchema is omitted samuelmbabhazi

    9.8.1
  • types: Use @standard-schema/spec for StandardSchema types rather than inlining #16341 #16339

    9.7.3

400 internal lines (docs, tests, tooling) left out.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.