Packages

mongoose

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

Upgrading mongoose From 8.24.11 to 9.12.2

52 releases in betweenevery note read

  1. 8.24.11yours
  2. 9.0.0major
  3. 11 releases
  4. 9.2.2security
  5. 2 releases
  6. 9.3.0breaking
  7. 35 releases
  8. 9.12.2target
  9. 2 pre

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

  • setDefaultsOnInsert: Check child filter paths before applying defaults, fix dot-notation handling, and prevent prototype pollution #16031 #16030

    9.2.2

Release by release

  1. 9.12.2

    16 Nov 20268 fixes
    • Fixed

      query: Make sanitizeFilter catch any fields that start with $ in top-level filter to avoid bypass using $_internalSchemaXor and other MongoDB internal expressions

    • Fixed

      query: Hardening for sanitizeProjection

    • Fixed

      array: Avoid converting BigInts to numbers in addToSet() #16693 luantaraschi

    • Fixed

      cursor: Propagate error passed to destroy() without re-emitting if error already emitted #16686 #16610 #16609 IbrahimHafez1

  2. 9.12.1

    9 Nov 20263 new · 6 fixes
    • New

      update: Avoid quadratic ancestor lookup in update validators and validate nested array subdocs once #16586 github.com/Re-cool

    • New

      Keep lib/ source within Latin-1 #16681 orgads

    • New

      map: Avoid quadratic concat() when creating a MongooseMap from an object #16677 ptweezy

    • Fixed

      array: Keep earlier pushed values when push() is called again with $each #16619 #16618 maxymlyskov

  3. 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

  4. 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()

  5. 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

  6. 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

  7. 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

  8. 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

30 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

81 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.