版本发布 8
9.3.0 / 2026-03-10 ================== * feat(schema): support `discriminators` option inline for better TypeScript support #16053 * feat(aggregate): add `pipelineForUnionWith()` helper to allow reusing pipelines with `$unionWith` in TypeScript #16033 * feat(setDefaultsOnInsert): pass query as context to default functions #16041 #16025 * fix: resolve deeply nested discriminator paths in arrayFilters #16072 [Yatin81](https://github.com/Yatin81) * fix(changeStream): emit ready on next tick to allow stream to initialize * fix(connection): handle calling watch() on disconnected connection * fix: remove references to mongodb option "promiseLibrary" [hasezoey](https://github.com/hasezoey) * fix(model+query): backwards compatible validateBeforeSave handling and avoid TypeError in removeUnusedArrayFilters on nullish update * perf(model): remove unnecessary overhead when saving new doc * types(InferRawDocType): fall back to using InferRawDocType instead of pulling non-raw inferred doc type if EnforcedDocType not set #16053 * types: add type constraints for `Document#$model()` and `Document#model()` [mrazauskas](https://github.com/mrazauskas) * docs: fix broken links and update MongoDB documentation links #16037 [hasezoey](https://github.com/hasezoey) * docs(contributing): update issue tracker links to Automattic org [AkaHarshit](https://github.com/AkaHarshit)
9.2.3 / 2026-02-26 ================== * types(model): make bulkSave() correctly take array of THydratedDocumentType #16032
9.2.2 / 2026-02-23 ================== * fix(document): make `pathsToSave` filter all update operators and preserve unsaved state #16027 * fix(setDefaultsOnInsert): check child filter paths before applying defaults, fix dot-notation handling, and prevent prototype pollution #16031 #16030 * fix(populate): make `refPath` work as a function, including map paths with `$*` #16035 #16028 * perf: optimize `pathsToSave` and indexed-path checks for subdocuments * types: remove duplicate definition of `UUIDToJSON` type #16029 * docs(field-level-encryption): clarify crypt_shared library usage and move `extraOptions` under `autoEncryption` #16026 #16015 * test(types): introduce TSTyche for type testing #16024
8.22.1 / 2025-02-04 ================== * fix: handle other top-level query operators in sanitizeFilter * fix(document): when cloning a doc with subdocs, make sure the subdocs parent is the cloned doc #15904 #15901 * types(models): support Mongoose query casting in AnyBulkWriteOperation filter property #15910 * types: add toBSON() to documents #15927
8.22.0 / 2026-01-27 =================== * feat(model): allow passing strict option to hydrate() #15944 #15940
9.1.2 / 2025-01-05 ================== * fix(subdocs): pass options to pre-save hooks for subdocs #15921 #15920 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez) * perf(model): select only _id when checking document existence during save() #15919 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
8.21.0 / 2025-12-29 =================== * feat(document): add support for getAtomics() to allow custom container types to utilize atomics #15817 * feat(document+model): pass options to pre('deleteOne') and update+options to pre('updateOne') hooks #15908 #15870 * fix: add support for typescript style enums #15914 #15913 [mjfwebb](https://github.com/mjfwebb)
9.0.2 / 2025-12-17 ================== * fix(model): trigger error post hook on bulkwrite when pre-hook throws an error #15882 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez) * fix(document): use bitwise OR to accumulate version mode flags #15893 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez) * types(queries): apply Mongoose casting to default MongoDB driver _id in RootFilterOperators #15891 #15887 #15779 * types(schema): correctly infer virtuals, methods on hydrated doc type from schema options #15892 * types: fixed this parameter type detection for methods with arguments #15885 [I-Enderlord-I](https://github.com/I-Enderlord-I) * types: export InferRawDocTypeWithout_id to replicate Mongoose 8 InferRawDocType behavior #15815 #15814 [JavaScriptBach](https://github.com/JavaScriptBach) * docs: improve colors on dark mode #15879 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez) * docs(model): add overwriteImmutable option #15884 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez) * refactor: remove internal callbacks for buffering #15890