chore(deps): update dependency mongoose --> v7
This MR contains the following updates:
Package | Change | Age | Adoption | Passing | Confidence |
---|---|---|---|---|---|
mongoose (source) | ^5.12.3 -> ^7.0.0 |
Release Notes
Automattic/mongoose
v7.2.0
==================
- feat: upgrade mongodb -> 5.5.0
- feat(document): add flattenObjectIds option to toObject() and toJSON() #13383 #13341
- feat(query): add translateAliases option to automatically call translate aliases on query fields #13397 #8678 #7511
- feat(schema): propagate toObject and toJSON options to implicitly created schemas #13325
- feat(model): add throwOnValidationError option for opting into getting MongooseBulkWriteError if all valid operations succeed in bulkWrite() and insertMany() #13410 #13256
- feat(types+mongoose): export MongooseError #13403 #13387 ramos-ph
v7.1.2
==================
- fix: set timestamps on single nested subdoc in insertMany() #13416 #13343
- fix: mention model name in missing virtual option in getModelsMapForPopulate #13408 #13406 hasezoey
- fix: custom debug function not processing all args #13418 #13364
- docs: add virtuals schema options #13407 hasezoey
- docs: clarify
JSON.stringify()
virtuals docs #13273 iatenine
v7.1.1
==================
- fix(document): handle set() from top-level underneath a map of mixed #13386
- fix: don't modify passed options object to
createConnection()
#13376 - types: make lean() not clobber result type for updateOne(), etc. #13389 #13382
- types: handle union types in FlattenMaps #13368 #13346 Jokero
- types(document): correct return type for Model.prototype.deleteOne(): promise, not query #13367 #13223
- types: update document.d.ts $set function params to match set #13304 jeffersonlipsky
- docs: add excludeIndexes to the guide schema options list #13377 #13287
- docs: fix broken "fork me" on home page #13336
v7.1.0
==================
- feat: upgrade mongodb -> 5.3.0
- feat(schema): add BigInt support, upgrade mongodb -> 5.3.0 #13318 #13081 #6936
- feat: handle MongoDB's new UUID type, export mongoose.Types.UUID #13323 #13103
- feat: implement createCollections() #13324
- feat(query): add isPathSelectedInclusive function on query #13177
- types: added overloads for Schema.pre/post with different values for SchemaPreOptions #12680 jpilgrim
- types(query): make lean() flatten out inferred maps into Record<string, V> #13326 #13010
- docs: update README deno url #13332
- docs: update jsdoc to use full URLs instead of non-prefix absolute urls (also fix some urls) #13328 hasezoey
- docs: reload api js files on change #13313 hasezoey
- docs: update website sidebar to be better use-able #13321 hasezoey
- docs: fix schematype @see links #13310 hasezoey
- docs(subdocuments): remove callback usage, use deleteOne() rather than remove() re: #13284 #13316
v7.0.5
==================
- fix(schema): correctly handle uuids with populate() #13317 #13267
- fix(schema): add clusteredIndex to schema options #13286 jakesjews
- fix(document): use collection.findOne() for saving docs with no changes to avoid firing findOne middleware #13298
- types(schema): avoid circular constraint in TSchemaOptions with --incremental by deferring ResolveSchemaOptions<> #13291 #13129
- docs(subdocs): fix mention of subdocument ".remove" function #13312 hasezoey
- docs: add mongoose.Promise removal to migrating to 7 guide #13295
- docs: updated formatting of Error Handling section to better highlight the two kinds of possible errors #13279 Ankit-Mandal
- docs: fix broken link #13301 #13281
v7.0.4
==================
- fix(schema): fix dangling reference to virtual in tree after removeVirtual() #13255 #13085
- fix(query): cast query filters on
findOneAndUpdate()
#13220 #13219 dermasmid - types(model): aligned watch() type for mongodb 4.6.0 #13208 #13206
- docs: fix async function anchors #13226 hasezoey
- docs: fix schema syntax in exemple #13262 c-marc
- docs: rework scripts to allow easier setting of current and past versions #13222 #13148 hasezoey
v7.0.3
==================
- fix(query): avoid executing transforms if query wasn't executed #13185 #13165
- fix(schema): make creating top-level virtual underneath subdocument equivalent to creating virtual on the subdocument #13197 #13189
- fix(timestamps): set timestamps on empty replaceOne() #13196 #13170
- fix(types): change return type of lean() to include null if nullable #13155 #13151 lpizzinidev
- fix(types): fixed type of DocumentArray constructor parameter #13183 #13087 lpizzinidev
- docs: refactor header naming to lessen conflicts #12901 hasezoey
- docs: change header levels to be consistent across files #13173 hasezoey
v7.0.2
==================
- fix: validate array elements when passing array path to validateSync() in pathsToValidate #13167 #13159
- fix(schema): propagate typeKey down to implicitly created subdocuments #13164 #13154
- fix(types): add index param to eachAsync fn #13153 krosenk729
- fix(types/documentarray): type DocumentArray constructor parameter as object #13089 #13087 lpizzinidev
- fix(types): type query
select()
as string, string[], or record; notany
#13146 #13142 rbereziuk - fix(types/query): change QueryOptions lean type to Record<string, any> #13150 lpizzinidev
- docs: add and run eslint-plugin-markdown #13156 hasezoey
- docs(generateSearch): fix search generation for API #13161 hasezoey
- docs(generateSearch): move config missing error to require #13160 hasezoey
- chore: remove unused docs libraries #13172 hasezoey
v7.0.1
==================
- fix(aggregate): added await to prevent exception in aggregate exec #13126 lpizzinidev
- fix(types): handle Record<string, never> as value for HydratedDocument TOverrides parameter #13123 #13094
- fix(types): remove "update" function #13120 hasezoey
- docs(compatibility): added mongoDB server compatibility for mongoose 7 #13102 lpizzinidev
- docs: Updated callback method for Model.findOne() #13096 Arghyahub
- chore: update github actions to not use ubuntu-18.04 anymore #13137 hasezoey
v7.0.0
==================
- BREAKING CHANGE: copy schema options when merging schemas using new Schema() or Schema.prototype.add() #13092
- feat(types): export mongodb types more robustly #12948 simon-abbott
- docs: fix populate docs #13090 hasezoey
- docs(migrating_to_6): added info about removal of reconnectTries and reconnectInterval options #13083 lpizzinidev
v6.11.1
===================
- fix(query): apply schema-level paths before calculating projection for findOneAndUpdate() #13348 #13340
- fix: add SUPMRESS_JEST_WARNINGS environment variable to hide jest warnings #13384 #13373
- types(model): allow overwriting expected param type for bulkWrite() #13292 hasezoey
v6.11.0
===================
- feat: upgrade to mongodb 4.16.0 for Deno+Atlas connection fix #13337 #13075
- perf: speed up creating maps of subdocuments #13280 #13191 #13271
- fix(query): set ObjectParameterError if calling findOneAndX() with filter as non-object #13338
- fix(document): merge Document $inc calls instead of overwriting #13322
- fix(update): handle casting doubly nested arrays with $pullAll #13285
- docs: backport documentation versioning changes to 6.x #13253 #13190 hasezoey
v6.10.5
===================
- perf(document): avoid unnecessary loops, conditionals, string manipulation on Document.prototype.get() for 10x speedup on top-level properties #12953
- fix(model): execute valid write operations if calling bulkWrite() with ordered: false #13218 #13176
- fix(array): pass-through all parameters #13202 #13201 hasezoey
- fix: improve error message when sorting by empty string #13249 #10182
- docs: add version support and check version docs #13251 #13193
v6.10.4
===================
- fix(document): apply setters on resulting value when calling Document.prototype.$inc() #13178 #13158
- fix(model): add results property to unordered insertMany() to make it easy to identify exactly which documents were inserted #13163 #12791
- docs(guide+schematypes): add UUID to schematypes guide #13184
v6.10.3
===================
- fix(connection): add stub implementation of doClose to base connection class #13157
- fix(types): add cursor.eachAsync index parameter #13162 #13153 hasezoey
- docs: fix 6.x docs sidebar links #13147 #13144 hasezoey
- docs(validation): clarify that validation runs as first pre(save) middleware #13062
v6.10.2
===================
- fix(document): avoid setting array default if document array projected out by sibling projection #13135 #13043 #13003
- fix(documentarray): set correct document array path if making map of document arrays #13133
- fix: undo accidental change to
engines
inpackage.json
#13124 lorand-horvath - docs: quick improvement to Model.init() docs #13054
v6.10.1
===================
- fix: avoid removing empty query filters in
$and
and$or
#13086 #12898 - fix(schematype): fixed validation for required UUID field #13018 lpizzinidev
- fix(types): add missing Paths generic param to
Model.populate()
#13070 - docs(migrating_to_6): added info about removal of reconnectTries and reconnectInterval options #13083 lpizzinidev
- docs: fix code in headers for migrating_to_5 #13077 hasezoey
- docs: backport misc documentation changes into 6.x #13091 hasezoey
v6.10.0
===================
- feat: upgrade to mongodb driver 4.14.0 #13036
- feat: added Schema.prototype.omit() function #12939 #12931 lpizzinidev
- feat(index): added createInitialConnection option to Mongoose constructor #13021 #12965 lpizzinidev
v6.9.3
==================
- fix(connection): delay calculating
autoCreate
andautoIndex
until after initial connection established #13007 #12940 lpizzinidev - fix(discriminator): allows update doc with discriminatorKey #13056 #13055 abarriel
- fix(query): avoid sending unnecessary empty projection to MongoDB server #13059 #13050
- fix(model): avoid sending null session option with document operations #13053 #13052 lpizzinidev
- fix(types): use MergeTypes for type overrides in HydratedDocument #13066 #13040
- docs(middleware): list validate as a potential query middleware #13057 #12680
- docs(getters-setters): explain that getters do not run by default on toJSON() #13058 #13049
- docs: refactor docs generation scripts #13044 hasezoey
v6.9.2
==================
- fix(model): fixed post('save') callback parameter #13030 #13026 lpizzinidev
- fix(UUID): added null check to prevent error on binaryToString conversion #13034 #13032 #13029 lpizzinidev Freezystem
- fix(query): revert breaking changes introduced by #12797 #12999 lpizzinidev
- fix(document): make array $shift() use $pop instead of overwriting array #13004
- docs: update & remove old links #13019 hasezoey
- docs(middleware): describe how to access model from document middleware #13031 AxeOfMen
- docs: update broken & outdated links #13001 hasezoey
- chore: change deno tests to also use MMS #12918 hasezoey
v6.9.1
==================
- fix(document): isModified should not be triggered when setting a nested boolean to the same value as previously #12994 lpizzinidev
- fix(document): save newly set defaults underneath single nested subdocuments #13002 #12905
- fix(update): handle custom discriminator model name when casting update #12947 wassil
- fix(connection): handles unique autoincrement ID for connections #12990 lpizzinidev
- fix(types): fix type of options of Model.aggregate #12933 ghost91-
- fix(types): fix "near" aggregation operator input type #12954 Jokero
- fix(types): add missing Top operator to AccumulatorOperator type declaration #12952 lpizzinidev
- docs(transactions): added example for Connection.transaction() method #12943 #12934 lpizzinidev
- docs(populate): fix out of date comment referencing onModel property #13000
- docs(transactions): fix typo in transactions.md #12995 Parth86
v6.9.0
==================
- feat(schema): add removeVirtual(path) function to schema #12920 IslandRhythms
- fix(cast): remove empty
$or
conditions after strict applied #12898 0x0a0d - docs: fixed typo #12946 Gbengstar
v6.8.4
==================
- fix(collection): handle creating model when connection disconnected with bufferCommands = false #12889
- fix(populate): merge instead of overwrite when match is on _id #12891
- fix: add guard to stop loadClass copying Document if Document is used as base of loaded class (same hack as implemented for Model already) #12820 sgpinkus
- fix(types): correctly infer types on document arrays #12884 #12882 JavaScriptBach
- fix(types): added omit for ArraySubdocument type in LeanType declaration #12903 piyushk96
- fix(types): add returnDocument type safety #12906 AbdelrahmanHafez
- docs(typescript): add notes about virtual context to Mongoose 6 migration and TypeScript virtuals docs #12912 #12806
- docs(schematypes): removed dead link and fixed formatting #12897 #12885 lpizzinidev
- docs: fix link to lean api #12910 manniL
- docs: list all possible strings for schema.pre in one place #12868
- docs: add list of known incompatible npm packages #12892 IslandRhythms
v6.8.3
==================
- perf: improve performance of assignRawDocsToIdStructure for faster populate on large docs #12867 Uzlopak
- fix(model): ensure consistent ordering of validation errors in insertMany() with ordered: false and rawResult: true #12866
- fix: avoid passing final callback to pre hook, because calling the callback can mess up hook execution #12836
- fix(types): avoid inferring timestamps if methods, virtuals, or statics set #12871
- fix(types): correctly infer string enums on const arrays #12870 JavaScriptBach
- fix(types): allow virtuals to be invoked in the definition of other virtuals #12874 sffc
- fix(types): add type def for Aggregate#model without arguments #12864 hasezoey
- docs(discriminators): add section about changing discriminator key #12861
- docs(typescript): explain that virtuals inferred from schema only show up on Model, not raw document type #12860 #12684
v6.8.2
==================
- fix(schema): propagate strictQuery to implicitly created schemas for embedded discriminators #12827 #12796
- fix(model): respect discriminators with Model.validate() #12824 #12621
- fix(query): fix unexpected validation error when doing findOneAndReplace() with a nullish value #12826 #12821
- fix(discriminator): apply built-in plugins to discriminator schema even if mergeHooks and mergePlugins are both false #12833 #12696
- fix(types): add option "overwriteModels" as a schema option #12817 #12816 hasezoey
- fix(types): add property "defaultOptions" #12818 hasezoey
- docs: make search bar respect documentation version, so you can search 5.x docs #12548
- docs(typescript): make note about recommending strict mode when using auto typed schemas #12825 #12420
- docs: add section on sorting to query docs #12588 IslandRhythms
- test(query.test): add write-concern option #12829 hasezoey
v6.8.1
==================
- fix(query): avoid throwing circular dependency error if same object is used in multiple properties #12774 orgads
- fix(map): return value from super.delete() #12777 danbrud
- fix(populate): handle virtual populate underneath document array with justOne=true and sort set where 1 element has only 1 result #12815 #12730
- fix(update): handle embedded discriminators when casting array filters #12802 #12565
- fix(populate): avoid calling transform if there's no populate results and using lean #12804 #12739
- fix(model): prevent index creation on syncIndexes if not necessary #12785 #12250 lpizzinidev
- fix(types): correctly infer this when using pre('updateOne') with { document: true, query: false } #12778
- fix(types): make InferSchemaType: consider { required: boolean } required if it isn't explicitly false #12784 JavaScriptBach
- docs: replace many occurrences of "localhost" with "127.0.0.1" #12811 #12741 hasezoey SadiqOnGithub
- docs(mongoose): Added missing options to set #12810 lpizzinidev
- docs: add info on
$locals
parameters to getters/setters tutorial #12814 #12550 IslandRhythms - docs: make Document.prototype.$clone() public #12803
- docs(query): updated explanation for slice #12776 #12474 lpizzinidev
- docs(middleware): fix broken links #12787 lpizzinidev
- docs(queries): fixed broken links #12790 lpizzinidev
v6.8.0
==================
- feat: add alpha support for Deno #12397 #9056
- feat: add deprecation warning for default strictQuery #12666
- feat: upgrade to MongoDB driver 4.12.1
- feat(schema): add doc as second params to validation message function #12564 #12651 IslandRhythms
- feat(document): add $clone method #12549 #11849 lpizzinidev
- feat(populate): allow overriding
localField
andforeignField
for virtual populate #12657 #6963 IslandRhythms - feat(schema+types): add { errorHandler: true } option to Schema post() for better TypeScript support #12723 #12583
- feat(debug): allow setting debug on a per-connection basis #12704 #12700 lpizzinidev
- feat: add rewind function to QueryCursor #12710 passabilities
- feat(types): infer timestamps option from schema #12731 #12069
- docs: change links to not link to api.html anymore #12644 hasezoey
v6.7.5
==================
- fix(schema): copy indexes when calling add() with schema instance #12737 #12654
- fix(query): handle deselecting _id when another field has schema-level select: false #12736 #12670
- fix(types): support using UpdateQuery in bulkWrite() #12742 #12595
- docs(middleware): added note about execution policy on subdocuments #12735 #12694 lpizzinidev
- docs(validation): clarify context for update validators in validation docs #12738 #12655 IslandRhythms
v6.7.4
==================
- fix: allow setting global strictQuery after Schema creation #12717 #12703 lpizzinidev
- fix(cursor): make eachAsync() avoid modifying batch when mixing parallel and batchSize #12716
- fix(types): infer virtuals in query results #12727 #12702 #12684
- fix(types): correctly infer ReadonlyArray types in schema definitions #12720
- fix(types): avoid typeof Query with generics for TypeScript 4.6 support #12712 #12688
- chore: avoid bundling .tgz files when publishing #12725 hasezoey
v6.7.3
==================
- fix(document): handle setting array to itself after saving and pushing a new value #12672 #12656
- fix(types): update replaceWith pipeline stage #12715 coyotte508
- fix(types): remove incorrect modelName type definition #12682 #12669 lpizzinidev
- fix(schema): fix setupTimestamps for browser.umd #12683 raphael-papazikas
- docs: correct justOne description #12686 #12599 tianguangcn
- docs: make links more consistent #12690 #12645 hasezoey
- docs(document): explain that $isNew is false in post('save') hooks #12685 #11990
- docs: fixed line causing a "used before defined" linting error #12707 sgpinkus
v6.7.2
==================
- fix(discriminator): skip copying base schema plugins if
applyPlugins == false
#12613 #12604 lpizzinidev - fix(types): add UUID to types #12650 #12593
- fix(types): allow setting SchemaTypeOptions' index property to IndexOptions #12562
- fix(types): set this to doc type in SchemaType.prototype.validate() #12663 #12590
- fix(types): correct handling for model #12659 #12573
- fix(types): pre hook with deleteOne should resolve this as Query #12642 #12622 lpizzinidev
v6.7.1
==================
- fix(query): select Map field with select: false when explicitly requested #12616 #12603 lpizzinidev
- fix: correctly find paths underneath single nested document with an array of mixed #12605 #12530
- fix(populate): better support for populating maps of arrays of refs #12601 #12494
- fix(types): add missing create constructor signature override type #12585 naorpeled
- fix(types): make array paths optional in inferred type of array default returns undefined #12649 #12420
- fix(types): improve ValidateOpts type #12606 Freezystem
- docs: add Lodash guide highlighting issues with cloneDeep() #12609
- docs: removed v5 link from v6 docs #12641 #12624 lpizzinidev
- docs: removed outdated connection example #12618 lpizzinidev
v6.7.0
==================
- feat: upgrade to mongodb driver 4.11.0 #12446
- feat: add UUID Schema Type (BSON Buffer SubType 4) #12268 #3208 hasezoey
- feat(aggregation): add $fill pipeline stage #12545 raphael-papazikas
- feat(types+schema): allow defining schema paths using mongoose.Types.* to work around TS type inference issues #12352
- feat(schema): add alias() method that makes it easier to define multiple aliases for a given path #12368
- feat(model): add mergeHooks option to Model.discriminator() to avoid duplicate hooks #12542
- feat(document): add $timestamps() method to set timestamps for save(), bulkSave(), and insertMany() #12540
v6.6.7
==================
- fix: correct browser build and improve isAsyncFunction check for browser #12577 #12576 #12392
- fix(query): allow overwriting discriminator key with overwriteDiscriminatorKey if strict: 'throw' #12578 #12513
v6.6.6
==================
- fix(update): handle runValidators when using $set on a doc array in discriminator schema #12571 #12518
- fix(document): allow creating document with document array and top-level key named schema #12569 #12480
- fix(cast): make schema-level strictQuery override schema-level strict for query filters #12570 #12508
- fix(aggregate): avoid adding extra $match stage if user manually set discriminator key to correct value in first pipeline stage #12568 #12478
- fix: Throws error when updating a key name that match the discriminator key name on nested object #12534 #12517 lpizzinidev
- fix(types): add limit to $filter expression #12553 raphael-papazikas
- fix(types): correct replaceWith type pipeline stage #12535 FabioCingottini
- fix(types): add missing densify type pipeline type #12533 FabioCingottini
- docs(populate): added transform option description #12560 #12551 lpizzinidev
- docs(connection): add sample to useDb() documentation #12541 lpizzinidev
- docs(guide): update broken read-preference links #12538 #12525 hasezoey
- chore: add TypeScript version field to issue template #12532 hasezoey
v6.6.5
==================
- fix(document): set defaults on subdocuments underneath init-ed single nested subdocument #12523 #12515
- fix: make Jest fake timers check more robust to other libs that overwrite time functions #12527 #12514
- fix(types): indicate that Schema.prototype.discriminator() returns this #12522 #12457
- fix(types): add "estimatedDocumentCount" and "countDocuments" as possible hooks #12519 #12516
- docs(models): add section on MongoDB Views #12526 #5694
- docs(subdocs): clarify that populated docs are not subdocs #12521 #12398
- docs(change-streams): remove unnecessary obsolete comment about needing to use mongodb driver change streams #12444
v6.6.4
==================
- fix(model): avoid saving applied defaults if path is deselected #12506 #12414
- fix(types): correct DocType for auto typed query helpers #12342
- fix(types): avoid "excessively deep" type instantiation error when using bulkWrite() with type that extends from document #12277
- fix(types): avoid relying on typeof this, which isn't supported in TypeScript < 4.4 #12375
- docs(schema): correct example for Schema.prototype.discriminator() #12493
- docs(typescript): clean up query helpers examples #12342
- chore: use mongodb-memory-server for testing #12262 hasezoey
v6.6.3
==================
- fix(query): treat findOne(_id) as equivalent to findOne({ _id }) #12485 #12325
- fix(timestamps): findOneAndUpdate creates subdocs with timestamps in reverse order #12484 #12475 lpizzinidev
- fix(types): make schema.plugin() more flexible for schemas that don't define any generics #12486 #12454
- fix(types): add "array of array key-value pairs" as a argument option for "query.sort()" #12483 #12434 hasezoey
- fix(types): remove unused defaults in "PluginFunction" #12459 hasezoey
- fix(types): update DiscriminatorSchema to have better names and combine statics #12460 hasezoey
v6.6.2
==================
- fix(model): avoid deleting shared schema methods in fix for #12254 #12423
- fix(document): set $inc default value in case field has not been specified on the document #12435 lpizzinidev
- fix(query): handle
select: false
on map paths in query results #12467 lpizzinidev - fix(types): add HydratedDocumentFromSchema to make it easier to pull inferred hydrated doc type #12464 #12319
- fix(types): add sanitizeFilter to types #12465 zrosenbauer
- fix(types): infer number enum types from schema if using enum: [0, 1] as const #12463 #12242
- docs(validation): add section on global schematype validation, clean up other issues #12430
- docs: add clarification about overwrite flag in model.js #12447 Tzvika-m
- docs: change to consistent "Example:" for jsdoc comments #12432 hasezoey
v6.6.1
==================
- fix: correctly apply defaults after subdoc init #12328
- fix(array): avoid using default _id when using pull() #12294
- fix: allow null values inside $expr objects #12429 MartinDrost
- fix(query): use correct Query constructor when cloning query #12418
- docs(website): remove setting "latest38x" which is not used anywhere #12396 hasezoey
v6.6.0
==================
- feat: upgrade mongodb driver -> 4.9.1 #12370 AbdelrahmanHafez
- feat: re-export default Mongoose instance properties for ESM named imports support #12256
- feat(model): add option to skip invalid fields with castObject() #12156 IslandRhythms
- feat: use setPrototypeOf() instead of proto to allow running on Deno #12315
- feat(QueryCursor): add support for AbortSignal on eachAsync() #12323
- feat(types): add types for new $densify operator #12118 IslandRhythms
v6.5.5
==================
- fix(setDefaultsOnInsert): avoid applying defaults on insert if nested property set #12279
- fix(model): make applyHooks() and applyMethods() handle case where custom method is set to Mongoose implementation #12254
- fix(types): add string "ascending" and "descending" index-directions #10269
- docs: upgrade dox to 1.0.0 #12403 hasezoey
- docs: update old mongodb nodejs driver documentation urls #12387 hasezoey
- docs: update JSDOC ... (spread) definition #12388 hasezoey
- refactor(model): allow optionally passing indexes to createIndexes and cleanIndexes #12280 AbdelrahmanHafez
v6.5.4
==================
- fix(document): allow calling $assertPopulated() with values to better support manual population #12233
- fix(connection+mongoose): better handling for calling model() with 1 argument #12359
- fix(model): allow defining discriminator virtuals and methods using schema options #12326
- fix(types): fix MongooseQueryMiddleware missing "findOneAndReplace" and "replaceOne" #12330 #12329 Jule- lpizzinidev
- fix(types): fix replaceOne return type #12351 lpizzinidev
- fix(types): use this for return type from $assertPopulated() #12234
- docs: highlight how to connect using auth in README #12354 AntonyOnScript
- docs: improve jsdoc comments for private methods #12337 hasezoey
- docs: fix minor typo in compatibility table header #12355 skyme5
v6.5.3
==================
- fix(document): handle maps when applying defaults to nested paths #12322
- fix(schema): make ArraySubdocuments apply _id defaults on init #12264
- fix(populate): handle specifying recursive populate as a string with discriminators #12266
- perf(types): remove extends Query in Schema.pre() and Schema.post(), loosen
discriminator()
generic #10349 - perf(types): some more micro-optimizations re: #10349, remove extra type checking on $ne, etc.
- fix(types): infer schema on
connection.model()
#12298 #12125 hasezoey - fix(types): add missing
findById()
type definitions #12309 lpizzinidev - fix(types): allow $search in $lookup pipeline stages for MongoDB v6.x support #12278 AbdelrahmanHafez
- fix(types): add parameter "options" to "Model.remove" #12258 hasezoey
- fix(types): sync single-generic-no-constraint "model" between "index.d.ts" and "connection.d.ts" #12299 hasezoey
- fix(types): update isDirectModified typing #12290 gabrielDonnantuoni
- docs: update links on api docs #12293 eatmoarrice
- docs: add note about language_override option #12310 IslandRhythms
- docs(document): add "String[]" to Document.depopulate as jsdoc parameter type #12300 hasezoey
- docs: update Node.js EventEmitter url #12303 rainrisa
v6.5.2
==================
- fix(aggregate): avoid throwing error when disconnecting with change stream open #12201 ramos-ph
- fix(query): overwrite top-level key if using Query.prototype.set() to set to undefined #12155
- fix(query): shallow clone options before modifying #12176
- fix(types): auto schema type inference on
Connection.prototype.model()
#12240 hasezoey - fix(types): better typescript support for schema plugins #12139 emiljanitzek
- fix(types): make bulkWrite() type param optional #12221 #12212
- docs: misc cleanup #12199 hasezoey
- docs: highlight current top-most visible header in navbar #12222 hasezoey
- docs(populate): improve examples for Document.prototype.populate() #12111
- docs(middleware): clarify document vs model in middleware docs #12113
v6.5.1
==================
- fix(timestamps): set timestamps on child schema when child schema has timestamps: true but parent schema does not #12119
- fix(schema+timestamps): handle insertMany() with timestamps and discriminators #12150
- fix(model+query): handle populate with lean transform that deletes _id #12143
- fix(types): allow $pull with _id #12142
- fix(types): add schema plugin option inference #12196 hasezoey
- fix(types): pass type to mongodb bulk write operation #12167 emiljanitzek
- fix(types): map correct generics from model to schema #12125 emiljanitzek
- fix(types): avoid baffling circular reference when using PopulatedDoc with a bidirectional reference #12136
- fix(types): allow using path with $count #12149
- docs(compatibility): change to use a table #12200 hasezoey
- docs(api_split.pug): add "code" to sidebar entries #12153 hasezoey
- docs: add "code" to Headers (and index list) #12152 hasezoey
v6.5.0
==================
- perf(document): avoid creating unnecessary empty objects when creating a state machine #11988
- feat: upgrade mongodb driver -> 4.8.1 #12103 AbdelrahmanHafez
- feat(model): allow passing timestamps option to Model.bulkSave(...) #12082 AbdelrahmanHafez
- feat(model): add castObject() function that casts a POJO to the model's schema #11945
- feat(document): add $inc() helper that increments numeric paths #12115
- feat(schema): add schema level lean option IslandRhythms
- feat(schema): add global id option to disable id on schemas #12067 IslandRhythms
- fix(connection): re-run Model.init() if re-connecting after explicitly closing a connection #12130
- feat(model): add applyDefaults() helper that allows applying defaults to document or POJO #11945
- feat(model): allow calling hydrate() with { setters: true } #11653
- feat(model): add hydrate option to Model.watch() to automatically hydrate fullDocument #12121
- feat(types): add support for automatically typed virtuals in schemas #11908 mohammad0-0ahmad
v6.4.7
==================
- fix(virtualtype): use $locals for default virtual getter/setter rather than top-level doc #12124
- fix(document): call subdocument getters if child schema has getters: true #12105
- fix(schematype): actually always return "this" where specified #12141 hasezoey
- fix(types): correct return value for Model.exists() #12094
- docs(guides): add link to advanced schemas doc #12073
- docs: handle @see in jsdoc #12144 hasezoey
- docs: make use of the deprecated tag available in jsdoc for documentation #12080 hasezoey
- docs(api_split): add basic DEMRECATED output #12146 hasezoey
- docs: various jsdoc cleanup #12140 hasezoey
- docs(api_split.pug): add "code" to parameter name #12145 hasezoey
v6.4.6
==================
- fix(schema): disallow setting proto when creating schema with dotted properties #12085
- fix(document): avoid mutating original object passed to $set() when applying defaults to nested properties #12102
- fix(query): apply lean transform option to top-level document #12093
- docs(migrating_to_6): correct example for
isObjectIdOrHexString()
#12123 LokeshKanumoori
v6.4.5
==================
- fix(model+timestamps): set timestamps on subdocuments in insertMany() #12060
- fix: correct isAtlas check #12110 skrtheboss
- fix(types): fix various issues with auto typed schemas #12042 mohammad0-0ahmad
- fix(types): allow any value for AddFields #12096
- fix(types): allow arbitrary expressions for ConcatArrays #12058
- fix(types): make $addToSet fields mutable to allow programatically constructing $addToSet #12091
- fix(types): add $let as a possible expression to $addFields #12087 AbdelrahmanHafez
- fix(types): fix $switch expression type #12088 AbdelrahmanHafez
- fix(types): correct options type for syncIndexes() #12101 lpizzinidev
- fix(types): avoid treating | undefined types as any in
Require_id
to better support_id: String
with auto-typed schemas #12070 - docs: fix up various jsdoc issues #12086 hasezoey
- docs: add sanitizeFilter to mongoose.set() options #12112 pathei-kosmos
v6.4.4
==================
- fix(types): allow using an object to configure timestamps #12061 lantw44
- fix(types): support findOneAndReplace with rawResult #12062 lantw44
- docs: upgrade API documentation parser #12078 #12072 #12071 #12024 hasezoey
- docs(document): add more info on $isNew #11990
- docs: add SchemaType doValidate() to docs #12068
v6.4.3
==================
- fix(document): handle validating deeply nested subdocuments underneath nested paths with required: false #12021
- fix(types): infer schematype type from schema paths when calling
SchemaType.path()
#11987 - fix(types): add $top and $topN aggregation operators #12053
- fix(types): clean up a couple of issues with $add and $ifNull #12017
- fix(types): allow $cond with $in #12028
- docs: add path level descending index example in docs #12023 MitchellCash
- docs: add Buffer, Decimal128, Map to docs #11971
v6.4.2
==================
- fix: keep autoIndex & autoCreate as true by default if read preference is primaryPreferred #11976
- fix(types): improve inferred Schema Type to handle nested paths and ObjectIds #12007 iammola
- fix(types): avoid inferring doc type from param to create() #12001
- fix(types): make populate Paths generic consistently overwrite doc interface #11955
- fix(types): allow null at ne expression second parameter #11996 jyeros
- fix(types): change index "weights" to be more explicit #11997 hasezoey
v6.4.1
==================
- fix(schema): allow 0 for numbers if required and ref both set #11912
- fix(query): skip applying default projections over slice projections #11940
- fix(types): handle arrays in ApplyBasicQueryCasting correctly #11964
- fix(types): fix $match typings #11969 andreialecu
- fix(types): avoid adding non-existent properties from model constructor for typegoose #11960
- fix(types): make Mongoose UpdateQuery compatible with MongoDB
UpdateFilter
#11911 - fix(types): simplify MergeType constraints #11978
- fix(types): correct references to Buffer for @types/node >= 16.0.0 < 16.6.0 #11963
- fix(types): re-add the possibility to pass undefined for projection in Model.find #11965 ghost91-
- fix(types): fix typo for indexes #11953 AbdelrahmanHafez
- fix(document+types): document merge option #11913
- docs: update schematypes.md #11981 korzio
- docs: update validation.md #11982 korzio
v6.4.0
==================
- feat: upgrade mongodb driver -> 4.7.0 #11909 AbdelrahmanHafez
- feat(types+document): add $assertPopulated() for working with manually populated paths in TypeScript #11843
- feat(mongoose): add setDriver() function to allow overwriting driver in a more consistent way #11900
- feat(types): add helpers to infer schema type automatically #11563 mohammad0-0ahmad
- feat: add
transform
option tolean()
#10423 IslandRhythms - feat(base): add support to set default immutable for createdAt globally #11888 AbdelrahmanHafez
- fix: make doValidate() on document array elements run validation on the whole subdoc #11902
- feat(types): add expression typings to Aggregate stages #11370 Uzlopak
- fix: remove
on
from schema reserved keys #11580 IslandRhythms
v6.3.9
==================
- fix(document): handle nested paths underneath subdocuments when getting all subdocuments for pre save hooks #11917
- fix(types): correct typing in post aggregate hooks #11924 GCastilho
- docs: remove connect-option reconnectTries and reconnectInterval #11930 Uzlopak
v6.3.8
==================
v6.3.7
==================
- fix(schema+document): allow disabling _id on subdocuments by default #11541
- fix(update): respect global strictQuery option when casting array filters #11836
- perf(document): avoid unnecessarily creating new options object on every
$set
#11541 - fix: toJSON with undefined path #11922 kerryChen95
- fix: add refPath to SchemaTypeOptions class #11862
- fix(types): handle boolean default functions #11828
- docs(populate): make path names in refPath section consistent #11724
v6.3.6
==================
- fix(update): apply timestamps to nested subdocs within $push and $addToSet #11775
- fix(document): use shallow clone instead of deep clone for
toObject()
options #11776 - fix: avoid checking for ObjectId with instanceof #11891 noseworthy
- fix(types): Allow sorting by text score #11893
- fix(types): allow schematype get() functions to return undefined #11561
- fix(types): add Schema.discriminator #11855 Uzlopak
- fix(types): discriminator generic type not being passed to schema #11898 GCastilho
v6.3.5
==================
- fix(document): avoid infinite recursion when calling toObject() on self-referencing document #11756
- fix(document): avoid manually populating documents that are manually populated in another doc with different unpopulatedValue #11442
- fix(document): fix ObjectId conversion for external schemas #11841 coyotte508
- fix: fix codeql warnings #11817 Uzlopak
- fix(types): allow passing TVirtuals to Schema class #11543
- fix(types): Type of Connection.transaction() #11825 dwrss
- docs(typescript): add coverage for TypeScript query helpers #11709
- docs: fix documention of error handling #11844 Uzlopak
- docs: typings mongoose.Error should reference to MongooseError #11850 Uzlopak
- chore: improve issue templates #11794 Uzlopak
- chore: use ts-benchmark instead of internal TS benchmarking #11798 mohammad0-0ahmad
v6.3.4
==================
- fix(schema): disallow using schemas with schema-level projection with map subdocuments #11698
- fix(document): avoid setting nested paths to null when they're undefined #11723
- fix: allow using comment with findOneAndUpdate(), count(),
distinct()
andhint
withfindOneAndUpdate()
#11793 - fix(document): clean modified subpaths when setting nested path to null after modifying subpaths #11764
- fix(types): allow calling
deleteModel()
with RegExp in TypeScript #11812 - docs(typescript): add section on PopulatedDoc to TypeScript populate docs #11685
v6.3.3
==================
- perf: avoid leaking memory when using populate() with QueryCursor because of reusing populate options with
_docs
#11641 - fix(types): add
_id
back for LeanDocument #11769 #11761 taxilian - fix(model): add skipValidation option for bulkWrite() to allow skipping validation for
insertOne
andreplaceOne
#11663 - fix(document): correctly $__reset() subdocuments that are under nested paths #11672
- fix(query): handle casting BSONRegExp instances as RegExps in queries #11597
- fix: correctly cast $not in $expr #11689
- perf: optimize size of browser bundle, use buffer v.5.7.1 package to match buffer package of mongodb in browser bundle #11765 Uzlopak
- docs: Query.populate docs do not include using an array of strings for the path param #11768 #11641 AbdelrahmanHafez
- chore: add GitHub workflow to close stale "can't reproduce", "help", "needs clarification" issues #11753 Uzlopak
- chore: remove Makefile dependency for compiling docs #11751 Uzlopak
v6.3.2
==================
- perf: avoid registering event listeners on subdocuments to reduce memory usage #11541
- fix(setDefaultsOnInsert): set default if sibling of nested path is $set #11668
- perf(document): remove unnecessary workaround for ignoring subpaths of arrays #11541
- fix(types): various fixes and improvements for types #11650 taxilian
- fix(types): make mongoose typings work without esmModuleInterop true #11695 Uzlopak
- fix(types): support populate(path, fields, model) syntax #11649 #11598 mohammad0-0ahmad
- fix(types): correct SchemaTypeOptions.get function signature #11561
- fix: fix browser build for Webpack 5 #11717
- docs: improve readme #11705 mahendrap1512
v6.3.1
==================
- perf: improve perf of key order #11639 Uzlopak
- fix(timestamps): set createdAt when creating new single nested subdocuments #11603
- fix: improve CastError message when throwing StrictModeError #11506
- fix: upgrade bson to match mongodb@4.5 #11676
- fix(populate): avoid populating single nested subdocs underneath arrays if there's no
ref
#11538 - fix: handle { capped: number } in schema definition with
createCollection()
#11539 - fix: call markModified before setting changes in Array and in DocumentArray methods #11660 josegl
- fix: only allow using minus path to remove auto-selected discriminatorKey from projection #11546
- fix(types): set context on virtual getters/setters by default #11543
- fix(types): correct return type for Connection.prototype.transaction #9919
- fix(types): allow model as document interface key when using
extends Document
#11629 - docs: improve populate typing #11690 onichandame
- docs: add information regarding typings-tests #11691 Uzlopak
- docs: fix jsdoc for mongoose.createConnection #11693 Uzlopak
v6.3.0
==================
- fix: upgrade mongodb driver -> 4.5.0 #11623 AbdelrahmanHafez
- feat(schema): allow defining discriminators on schema and in schema definition #7971 IslandRhythms
- feat(base): add option to set allowDiskUse globally #11554 AbdelrahmanHafez
- feat(schema): add
removeIndex()
andclearIndex()
#11547 IslandRhythms - feat(cursor): add
continueOnError
option to allow executingeachAsync()
on all docs even if error occurs #6355 - feat(query): add
versionKey
option tolean()
for removing version key from lean docs #8934 IslandRhythms - feat(types): create new ProjectionType type for select(), find(), etc. #11437
- chore: use webpack 5 for browser build #11584 AbdelrahmanHafez
v6.2.11
===================
- fix(document): handle validation with triply nested document arrays #11564
- fix(query): skip applying string schema setters on $regex #11426
- fix: skip findOneAndReplace() validation if runValidators = false #11559
- fix(model): correctly handle schema-level collations in syncIndexes() #7621
- fix(types): correct populate query return type with lean #11560 mohammad0-0ahmad
- fix(types): allow using { type: Mixed } as schema type definition for any path #10900
- docs: fix example on Schema.prototype.post() #11648 EmilienLeroy
- docs: fix typo in methods/index.js #11651 eltociear
v6.2.10
===================
- fix(types): improve lastErrorObject typing for rawResults #11602 simllll
- docs(typescript): add note about deprecating extends Document #11619 AbdelrahmanHafez
- docs: consistent syntax highlighting with upgraded highlight.js #11579 AbdelrahmanHafez
v6.2.9
==================
- perf(document+model): make a few small optimizations #11380
- fix(types): improve populate return type #11560 mohammad0-0ahmad
- fix(document): avoid marking paths as modified on subdocument defaults #11528
- docs(schema): add example to index
expires
option #11557 boly38 - docs(model): add change stream docs #11275
- docs(lambda): update Lambda docs for Mongoose 6 #11275
- docs(connections): add note about connecting with X509 #11333
- docs(populate): fix incorrect path name in
refPath
example #11565 chandiwalaaadhar
v6.2.8
==================
- fix(document): handle casting array of spread docs #11522
- fix(document): avoid setting nested properties on top-level document when initing with strict: false #11526
- fix(document): correctly handle deeply nested subdocuments when getting paths to validate #11501
- fix(types): avoid making TInstanceMethods any by default leading to
this = any
in middleware #11435 - fix(types): allow defining array default if using Types.Array<> in document interface #11391
- docs(migrating_to_6): describe breaking change in Mongoose 6 about default query populate model #11289
- docs(middleware): fix typo #11537 x1489
v6.2.7
==================
- perf(document): avoid running validation on every array element if there's no validators to run #11380
- fix(cursor): correctly populate in batches when batchSize is set #11509
- fix(connection): avoid setting MongoClient on useDb() connections until after setting on base connection #11445
- fix(schema): throw more helpful error when using schema from a different version of Mongoose module #10453
- fix: add missing timeseries expiration handling #11489 #11229 Uzlopak
- docs: correct Model.findOneAndReplace docs param naming #11524 anatolykopyl
v6.2.6
==================
- fix(types): correct reference to cursor TypeScript bindings #11513 SimonHausdorf
- fix(types): allow calling Query.prototype.populate() with array of strings #11518
- fix(types): export and refactor types of PreMiddlewareFunction, PreSaveMiddlewareFunction, PostMiddlewareFunction, ErrorHandlingMiddlewareFunction #11485 Uzlopak
v6.2.5
==================
- fix(mongoose): add isObjectIdOrHexString() to better capture the most common use case for
isValidObjectId()
#11419 - fix(query): prevent modifying discriminator key in updates using operators other than
$set
#11456 - fix(populate+types): call foreignField functions with doc as 1st param, better typings for
localField
andforeignField
functions #11321 - fix(populate): return an array when using populate count on an array localField #11307
- fix(query): avoid error when using $not with arrays #11467
- perf: only deep clone validators if necessary #11412 Uzlopak
- fix(types): rename definition files to lowercase to avoid typescript bug #11469
- fix(types): aggregate.sort() accepts a string but also
{ field: 'asc'|'ascending'|'desc'|'descending' }
#11479 simonbrunel - fix(types): extract and refactor aggregationcursor and querycursor #11488 Uzlopak
- fix(types): extract and refactor schemaoptions #11484 Uzlopak
- fix(types): make first param to
Query.prototype.populate()
a string #11475 minhthinhls - fix(types): improve type checking for doc arrays in schema definitions #11241
- docs: fix length comparaison in lean.test.js #11493 zazapeta
- docs(timestamps): fix typo #11481 saibbyweb
- docs: fix broken link to rawResult #11459 chhiring90
v6.2.4
==================
- fix(query): correctly return full deleteOne(), deleteMany() result #11211
- fix(query): handle update validators on deeply nested subdocuments #11455 #11394
- fix(discriminator): handle modifying multiple nested paths underneath a discriminator #11428
- perf: improve isAsyncFunction #11408 Uzlopak
- fix(index.d.ts): add typedefs for Schema
pick()
#11448 Moisei-Shkil - fix(index.d.ts): allow type override for distinct() #11306
- fix(index.d.ts): allow array of validators in schema definition #11355
- fix(index.d.ts): improve connection typings #11418 Uzlopak
- docs: add timestamps docs #11336
- docs(timestamps): explain how timestamps works under the hood #11336
- docs(migrating_to_6): add model.exists breaking change returning doument instead of boolean #11407 AbdelrahmanHafez
- docs(index.d.ts): add docs for FilterQuery, UpdateQuery, and LeanDocument #11457 Moisei-Shkil
v6.2.3
==================
- fix(model): avoid dropping base model indexes when using discriminators with
Connection.prototype.syncIndexes()
#11424 #11421 AbdelrahmanHafez - fix(document): handle array defaults when selecting element underneath array #11376
- fix(populate): correctly handle depopulating populated subdocuments #11436
- fix(utils): improve deepEqual() handling for comparing objects with non-objects #11417
- fix(schema): allow declaring array of arrays using
[{ type: [String] }]
#11252 - perf: improve validation sync and async by replacing forEach with classic for loops #11414 Uzlopak
- perf: make hasDollarKeys faster #11401 Uzlopak
- fix(index.d.ts): ValidationError
errors
only contains CastError or ValidationError #11369 Uzlopak - fix(index.d.ts): make InsertManyResult.insertedIds return an array of Types.ObjectId by default #11197
- fix(index.d.ts): allow pre('save') middleware with pre options #11257
- fix(index.d.ts): add
suppressReservedKeysWarning
option to schema #11439 hiukky - docs(connections): improve replica set hostname docs with correct error message and info about
err.reason.servers
#11200 - docs(populate): add virtual populate match option documentation #11411 remirobichet
- docs(document): add note to API docs that flattenMaps defaults to
true
fortoJSON()
but nottoObject()
#11213 - docs(document+model): add populate option to populate() API docs #11170
- docs(migrating_to_6): add additional info about removing omitUndefined #11038
- docs(migrating_to_6): add model.exists breaking change returning doument instead of boolean AbdelrahmanHafez
v6.2.2
==================
- fix: fix QueryCursor and AggregationCursor compatibility with Node v17.5 #11381 benjamingr
- fix: better esm support, no necessity for setting allowSyntheticDefaultImports and esModuleInterop #11343 Uzlopak
- fix(model): apply projection parameter to hydrate() #11375
- fix: fix issue with creating arrays of length > 10000 #11405 Uzlopak
- fix(document): minimize single nested subdocs #11247
- fix(connection): handle reopening base connection with useDb() #11240
- perf: use property access instead of
get()
helper where possible #11389 Uzlopak - fix: use
isArray()
instead ofinstanceof Array
#11393 Uzlopak - perf: improve performance of
cast$expr()
#11388 Uzlopak - perf: remove
startsWith()
fromisOperator()
#11400 Uzlopak - fix(index.d.ts): extract
PipelineStage
into separate file #11368 Uzlopak - fix(index.d.ts): fix $search highlight path option type #11373 lmX2015
- docs: update changelog file to CHANGELOG.md #11365 AbdelrahmanHafez
- docs: fix broken links #11388 #11377 saibbyweb
- docs: remove double determiners in connections docs #11340 Erma32
v6.2.1
===================
- fix(document): handle validation with triply nested document arrays #11564
- fix(query): skip applying string schema setters on $regex #11426
- fix: skip findOneAndReplace() validation if runValidators = false #11559
- fix(model): correctly handle schema-level collations in syncIndexes() #7621
- fix(types): correct populate query return type with lean #11560 mohammad0-0ahmad
- fix(types): allow using { type: Mixed } as schema type definition for any path #10900
- docs: fix example on Schema.prototype.post() #11648 EmilienLeroy
- docs: fix typo in methods/index.js #11651 eltociear
v6.2.0
==================
- feat: upgrade MongoDB driver to 4.3.1
- feat(connection+mongoose): add support for continueOnError for syncIndexes #11266 AbdelrahmanHafez
- feat(query): cast literals in
$expr
where possible #10663 - feat(schema+mongoose): add pluginTags to allow applying global plugins to only schemas with matching tags #9780
- feat(discriminator): support overwriteModels:true to reuse discriminator names #11244 #10931 IslandRhythms
- feat(index.d.ts): add DocType generic param to Model functions that return queries to better support projections #11156
- feat(error): export MongooseServerSelectionError #11202
- feat(schematype): add validators, path, isRequired to public API and TypeScript types #11139
- fix(model): make exists(...) return lean document with _id or null instead of boolean #11142 AbdelrahmanHafez
- fix(model): support storing versionKey in nested paths #10980
- fix(index.d.ts): add options to
bulkSave()
type def #11201 Uzlopak - fix(index.d.ts): better support for query projections #11210 EugeneKorshenko
v6.1.10
===================
- fix(mongoose): correctly handle destructured isValidObjectId #11304
- fix(mongoose): defer to MongoDB driver isValid() for
isValidObjectId()
#11227
v6.1.9
==================
- fix(query): respect nested schema strict as default when casting query filters #11291
- fix(mongoose): make isValidObjectId() consistent with isValid(), make
ObjectId()
casting more flexible #11209 - fix(setDefaultsOnInsert): ignore defaults underneath maps #11235
- fix(query): avoid setting nested schema properties that are stripped out by strictQuery to undefined in query filter #11291
- fix: check for all flags in a regex deepequal #11242 Uzlopak
- fix: replace substr with substring #11278 Uzlopak
- docs: port for documentation testing in CONTRIBUTING.md #11273 Uzlopak
v6.1.8
==================
- fix(connection): stop leaking sessions in .transaction() #11259 #11256 Uzlopak
- perf: remove sliced in favor of Array.prototype.slice() #11238 Uzlopak
- perf: improve setDottedPath #11264 Uzlopak
- fix(document): handle edge case where NestJS sets String.type = String, mixing up schema definitions #11199
- fix: remove obsolete code after upgrading to bson4 #11265 Uzlopak
- fix: remove util.isArray in favor of Array.isArray #11234 Uzlopak
- fix(index.d.ts): avoid UnpackedIntersection making
findOne().populate()
result non-nullable #11041 - docs(migration): add note to change default functions to schema #11245 AbdelrahmanHafez
- docs: updated docs and issue templates for new FAQs #11171 IslandRhythms
- chore: fix casting benchmark #11262 Uzlopak
- chore: add mongodb-memory-server to test easier locally #11255 Uzlopak
- chore: fix testing tsconfig #11243 Uzlopak
- refactor: move utils.random to test folder #11239 Uzlopak
v6.1.7
==================
- fix(model): correct handling for $push on a nested array #11108
- fix(update): correctly apply timestamps to update pipelines #11151
- fix(document): correctly handle modifying array subdocument after setting array subdocument to itself #11172
- fix(index.d.ts): allow passing options to model() in place of removed
skipInit
#11137 - fix(aggregate): allow passing verbosity to Aggregate.prototype.explain() #11144
- fix(index.d.ts): avoid TypeScript inferring _id as any type with HydratedDocument #11085
- docs: fix Node.js Driver compat link #11214 wesbos
- docs: remove extraneous backquote #11204 joebowbeer
v6.1.6
==================
- perf(document): delay creating document event emitter until used to improve memory usage, several small improvements to improve initing docs with large arrays #10400
- fix(model): avoid
bulkSave()
error whenversionKey: false
#11186 #11071 IslandRhythms - fix(model): revert #11079:
findByIdAndUpdate(undefined)
breaking change #11149 - fix(index.d.ts): support strings in deep populate #11181 ivalduan
- fix(index.d.ts): rename map() -> transform() to line up with change in v6.0 #11161
- fix(index.d.ts): allow new Model(obj) for stricter type checks #11148
- fix(index.d.ts): make Schema.prototype.pre() and post() generics default to HydratedDocument #11180
- docs: improve autoCreate docs #11116
- docs(schematype): add missing parameter to example #11185 kerolloz
- docs(connections): use updated link to list of MongoDB Node driver
connect()
options #11184 splinter - docs(aggregate): fix formatting #11191 enieber
- docs: fix broken link #11179 khairnarsaurabh23
v6.1.5
==================
- perf(index.d.ts): simplify Schema typedef for query helpers and methods to significantly reduce TS compiler overhead #10349
- fix(document): allow populating deeply nested models as strings #11168 #11160 AbdelrahmanHafez
- fix(query): allow calling limit() and skip() with a string #11017
- fix(cursor): propery apply selected fields when loading discriminator docs with query cursor #11130
- fix(mongoose+connection): clone schema correctly when passing instance of another Mongoose instance's Schema to Connection.prototype.model() #11047
- fix(index.d.ts): handle primitives with FlattenMaps #11117
- fix(index.d.ts): enforce id on lean query result type #11118
- fix(index.d.ts): export facet stage type #11150 mhoc
- fix(index.d.ts): correct return type of projection method #11176 EugeneKorshenko
- fix(index.d.ts): additional fix for
$group
pipeline stage #11140 #11067 EugeneKorshenko - docs: update CONTRIBUTING.md for TS tests #11164 ahmedelshenawy25
- docs: use es6 object destructuring instead of regular dot operator for accessing value in object #11147 Shivaansh-Agarwal
v6.1.4
==================
- fix(document): handle save with undefined nested doc under subdoc #11110
- fix(document): allow manually populating subdocument refs with
create()
#10856 - fix(populate): handles refPath underneath map of subdocuments #9359
- fix(update): throw error when calling findByIdAndUpdate with undefined id #11079 gramliu
- fix(mongoose): export ConnectionStates #11133 orgads
- fix(index.d.ts): unpack array when using generic type override with
populate()
#11027 - fix(index.d.ts): fix typings in Merge stage #11132
- fix(index.d.ts): PipelineStage.Merge interface definition is wrong #11109
- docs(typescript): add note about Schema.Types.ObjectId vs Types.ObjectId in document definition #10949
- docs(connection): clarify that "connected" and "open" are different #10886
- docs(populate): correct refPath example to not use on as a schema path name #11113
- docs: fix
strictQuery
example #11135 MontgomeryWatts
v6.1.3
==================
- perf(populate): avoid duplicate model names when using refPath to avoid O(n^2) memory growth with number of array elements #10983
- fix(schema+model): cast paths marked with ref when hydrating #11052
- fix(schema): handle default function that returns null on document arrays #11058
- fix(document): clean modified paths when setting deeply nested subdocument #11060
- fix(populate): report full path when throwing strictPopulate error with deep populate #10923
- fix(connection): allow calling
setClient()
when disconnected #11114 hustxiaoc - fix(index.d.ts): fix typings in Group stage #11124 DavideViolante
- fix(index.d.ts): add Mongoose.prototype.trusted() function to type defs #10957
- fix(index.d.ts): allow use type string in $unset update with aggregation pipeline #11107 rpenido
- fix(index.d.ts) treat _id like other fields in $project #11102
- docs(migrating_to_6): add omitUndefined to Mongoose 6 migration guide #10672
- docs: add MongooseDocumentArray to API docs #10998
- docs: fix typo in model.js #11121 eltociear
- docs: fix typo in validation.md #11103 warlock1996
v6.1.2
==================
- fix: upgrade mongodb driver to 4.2.2 #11092 lorand-horvath
- fix(model): respect discriminators when calling Model.watch() #11007
- fix(populate): allow referencing parent connection models by name when using
useDb()
#11003 - fix(query): support options param to
Query.prototype.countDocuments()
#11037 - fix(query): correctly use awaitData instead of awaitdata in
Query.prototype.tailable()
#10875 - fix(index.d.ts): fix replaceRoot type #11098 alibehroozi
- fix(index.d.ts): add missing syncIndexes() definition to Mongoose global and Connection class #11065
- fix(index.d.ts): add boolean type for transform option #11057 AliYusuf95
- docs(model.estimatedDocumentCount): add await into example to get value from the Query #11044 olecom
- docs: fix broken build from awaitdata comment #11096 medolino
- docs: correct Query.prototype.transform() docs #11094 medolino
v6.1.1
===================
- fix(mongoose): correctly handle destructured isValidObjectId #11304
- fix(mongoose): defer to MongoDB driver isValid() for
isValidObjectId()
#11227
v6.1.0
==================
- feat(populate): support ref on subdocuments #10856
- feat(document): add
ownerDocument()
method to top-level document for consistency with subdocs #10884 IslandRhythms - fix: upgrade to mongodb driver 4.2.1 #11032 #10985 lorand-horvath has-n
- feat(schema): support
timeseries
option for MongoDB 5 time series collections support #10611 - feat(mongoose): add global
strictPopulate
option #10694 IslandRhythms - feat(mongoose+connection): add global
mongoose.syncIndexes()
andConnection.prototype.syncIndexes()
#10893 IslandRhythms - feat(query): support removing fields from projections #10630 canac
- feat(aggregate): add unionWith method to aggregate #10961 saeidasadi
- fix(index.d.ts): types for aggregation pipeline stages #10971 jeremyben
v6.0.15
===================
- fix(document): avoid overwriting schema methods when creating a new document with
new Model()
andstrict: false
#11001 - fix(document): avoid overwriting top-level document _id with nested
_id
whenstrict = false
#10934 - fix(collection): avoid double-calling callback on sync error #10956
- fix(connection): handle direct connection to uninitialized replica set that then becomes initialized #10948
- fix(index.d.ts): allow partial updates on subdocuments for defaults #10947
- fix(index.d.ts): handle buffer type in schema definitions #11026
v6.0.14
===================
- fix(document): catch errors in required functions #10968
- fix(connection): clone schema when passing a schema from a different copy of Mongoose to
Connection#model()
#10904 - fix(populate): set empty array [] on virtual populate with no result #10992
- fix(query): handle orFail() with replaceOne() #10963
- fix(populate): use Model by default when using Model.populate() on a POJO #10978
- fix(document): throw VersionError if saving a document with version bump and document isn't found #10974
- fix(index.d.ts): make populate type param optional #10989 mohd-akram
- docs(migrating_to_6): add a note about minimize and toObject() behavior change in v5.10.5 #10827
- docs: remove duplicate
path
in docs #11020 ItWorksOnMyMachine - docs: fix typo in populate docs #11015 gavi-shandler
- docs: fix typo in model.js #10982 eltociear
v6.0.13
===================
- fix(document): allows validating doc again if pre validate errors out #10830
- fix: upgrade to mongodb driver 4.1.4 #10955 mohd-akram
- fix(schema): handle functions with accidental type properties in schema definitions #10807
- fix(path): add check to avoid flattening dotted paths on Mongoose docs, improve error when flattening dotted paths causes conflicts #10825
- fix(index.d.ts): rename EnforceDocument -> HydratedDocument, export HydratedDocument for easier typing for users #10843
- fix(index.d.ts): handle maps in TypeScript schema definitions #10838
- fix(index.d.ts): add clone to query #10943 asportnoy
- fix(index.d.ts): add strictQuery global option #10933
- fix(index.d.ts): add generic to allow overriding
Schema#clone()
return type #10951 StefanoA1 - docs(typescript): add quick guide to virtuals in TypeScript #10754
- docs(aggregate): remove exec() from AggregationCursor example, no longer correct for Mongoose 6 #10862
- docs(document.js): fix link leading to old github pages site #10958 PuneetGopinath
- docs: fixed typo in document.js #10950 Haosik
v6.0.12
===================
- fix(cursor): remove the logic for emitting close, rely on autoDestroy option for Node 12 support #10906 iovanom
- fix(map): support passing flattenMaps: false to Map toJSON(), make
toJSON()
flatten maps by default in TypeScript #10872 - fix: upgrade to mongodb driver 4.1.3 #10911 orgads
- fix(index.d.ts): correct TS function signature for
SchemaType.prototype.set()
#10799 - fix(index.d.ts): support implicit $in in FilterQuery #10826
- fix(index.d.ts): More precise type for Schema.clone() #10899 coyotte508
- fix(index.d.ts): add caster property to schema arrays and document arrays #10865
- docs: update
updateMany()
anddeleteMany()
docs to reflect newmatchedCount
,modifiedCount
,deletedCount
properties #10908 IslandRhythms - docs: fix broken links to populate virtuals #10870 IslandRhythms
- docs: updated docs to have returnOriginal, removed new and returnDocument #10887 IslandRhythms
v6.0.11
===================
- perf(index.d.ts): remove some unnecessary definitions, streamline some union types to reduce number of instantiations #10349
- fix(cursor): use stream destroy method on close to prevent emitting duplicate 'close' #10878 #10876 iovanom
- fix: create indexes when readPreference=primary is set #10861 #10855 gemyero
- fix(document): avoid depopulating when setting array of subdocs from different doc #10819
- fix(index.d.ts): allow modifying properties of UpdateQuery instances #10786
- fix(index.d.ts): add generic Paths to populate() to allow overriding path types #10758
v6.0.10
===================
- fix(query): add back strictQuery option to avoid empty filter issues, tie it to
strict
by default for compatibility #10781 #10763 - fix(model): avoid unnecessarily dropping text indexes in
syncIndexes()
#10851 #10850 IslandRhythms - fix(query): avoid trying to call toArray() on cursor if find() error occurred #10845
- fix: accepts uppercase values in mongoose.isValidObjectId #10846 foxadb
- perf(document): further reduce unnecessary objects and keys to minimize document memory overhead #10400
- fix(index.d.ts): restore unpacked type and avoid distributive conditional types #10859 dbellavista
- fix(index.d.ts): add correct null typings for
findOneAndUpdate()
andfindByIdAndUpdate()
#10820 - fix(index.d.ts): make insertMany() correctly return Promise if passing single document to
insertMany()
#10802 - fix(index.d.ts): avoid weird issue where TypeScript 4.3.x and 4.4.x makes string extend Function #10746
- fix(index.d.ts): allow type:
SchemaTypeOptions[]
when defining schema #10789 - fix(index.d.ts): allow using
$in
with enum fields #10757 #10734 - fix(index.d.ts): add missing fields and options params to Model constructor #10817
- fix(index.d.ts): support extending type for mongoose.models #10806 MunifTanjim
- docs: enhance docs section linking #10779 saveman71
- docs(middleware): add missing query middleware #10721
- docs: fix typo #10853 mdatif796
- docs: add missing to #10848 digidub
v6.0.9
==================
- fix(document): init non-schema values if strict is set to false #10828
- fix(document): correctly track saved state for deeply nested objects #10773
- fix(array): avoid mutating arrays passed into Model() constructor #10766
- fix(cursor): allow using find().cursor() before connecting, report errors in pre('find') hooks when using
.cursor()
#10785 - fix(populate): support ref: Model with virtual populate #10695
- fix(schema): support type: { subpath: String } in document array definitions and improve schema
interpretAsType
error messages if type name is undefined #10750 - fix: upgrade to mongodb driver 4.1.2 #10810 orgads
- fix(subdocument): add extra precaution to throw an error if a subdocument is a parent of itself in
ownerDocument()
#9259 - perf(index.d.ts): make
model()
call more strict to improve VS Code autocomplete perf #10801 traverse1984 - fix(index.d.ts): allow calling depopulate with 0 args #10793
- fix(index.d.ts): Add type definitions for allowDiskUse #10791 coyotte508
- docs(populate): expand virtual populate docs with info on principle of least cardinality and other info #10558
- docs: add migration guide to side bar #10769
- docs(connections+api): clarify that maxPoolSize is now 100 by default #10809
- docs(schema): add Schema#virtuals to docs as a public property #10829
- docs: remove array indexes section from FAQ #10784 Duchynko
- docs(model): fix broken example #10831 Okekeprince1
- docs: fix markdown issue with schemas.md #10839 aseerkt
v6.0.8
==================
- fix: support $set on elements of map of subdocuments #10720
- fix(schematype): handle schema type definition where unique: false and
index
not set #10738 - fix(timestamps): handle
createdAt
with customtypeKey
#10768 #10761 jclaudan - fix(model): amend Model.translateAliases to observe non-aliased sub schemas #10772 frisbee09
- fix: allow ObjectId#valueOf() to override built-in
Object#valueOf()
, clarify using==
with ObjectIds in migration guide #10741 - fix: use process.emitWarning() instead of console.warn() for warnings #10687
- fix(index.d.ts): allow array of schema type options for string[],
number[]
property Schema definitions #10731 - fix(index.d.ts): make built-in subdocument properties not required in UpdateQuery #10597
- docs(ssl): correct sslCA option and clarify that sslCA should be the path to the CA file #10705
v6.0.7
==================
- fix(populate): wrap populate filters in trusted() so they work with
sanitizeFilter
#10740 - fix(aggregate): handle calling aggregate() before initial connection succeeds #10722
- fix(query): avoid throwing error when using
$not
with$size
#10716 IslandRhythms - fix(discriminator): handle setting nested discriminator paths #10702
- fix(documentarray): don't throw TypeError on DocumentArray#create() when top-level doc has populated paths #10749
- fix(update): avoid setting single nested subdoc defaults if subdoc isn't set #10660
- fix: delay creating id virtual until right before model compilation to allow plugins to disable the
id
option #10701 - fix(connection): correct
auth
object when usinguser
option toconnect()
#10727 #10726 saveman71 - fix(timestamps): avoid calling getters when checking whether
createdAt
is set #10742 kaishu16 - fix(index.d.ts): allow using strings for ObjectIds with $in #10735
- fix(index.d.ts): add TVirtuals generic to Model to make it easier to separate virtuals from DocType #10689
- fix(index.d.ts): add Model.bulkSave() definition #10745
- fix(index.d.ts): allow RegExp for
match
in schema definition #10744 easen-amp - fix(index.d.ts): allow arbitrary additional keys in QueryOptions #10688
- docs: correct TypeScript schema generic params in docs #10739 minifjurt123
- docs: fix h2 header links #10682 IslandRhythms
v6.0.6
==================
- perf(index.d.ts): streamline SchemaDefinitionType and SchemaTypeOptions to reduce number of instantiations and speed up lib checking #10349
- perf(document): make $locals a getter/setter, avoid creating unnecessary
undefined
properties in Document constructor, remove unnecessary event listeners #10400 - fix(connection): use username parameter for MongoDB driver instead of user #10727 saveman71
- fix(update): handle casting $or and $and in array filters #10696
- fix(connection): allow calling connection helpers before calling
mongoose.connect()
#10706 - fix(document): correctly handle subpaths of arrays that contain non-alphanumeric chars like
-
#10709 - fix(index.d.ts): correct return value for findOneAndUpdate(),
findByIdAndUpdate()
to support query helpers #10658 - fix(index.d.ts): add missing methods to ValidationError & ValidatorError classes #10725 medfreeman
- perf(subdocument): make internal $isSingleNested and
$isDocumentArrayElement
properties constants on the prototype rather than setting them on every instance #10400 - docs: improve Document#populate documentation, tests #10728 saveman71
v6.0.5
==================
- fix(model): allow calling Model.validate() static with POJO array #10669
- fix(cast): let $expr through in query filters if strict mode enabled #10662
- fix(map): propagate flattenMaps option down to nested maps #10653
- fix(setDefaultsOnInsert): avoid adding unnecessary auto _id to $setOnInsert #10646
- fix(schema): support object with values and message syntax for Number enums #10648
- fix(index.d.ts): fix Document#populate() type #10651 thiagokisaki
- fix(index.d.ts): allow using $in and $nin on array paths #10605
- fix(index.d.ts): make _id required in query results and return value from
create()
#10657 - docs: update deprecations.md to reflect version 6 #10673 multiwebinc
- docs: fix typo in queries.md #10681 yogabonito
- docs: fix typo in models.md #10680 yogabonito
- ci: add test for ubuntu-20.04 #10679 YC
v6.0.4
==================
- fix(schema): handle maps of maps #10644
- fix: avoid setting defaults on insert on a path whose subpath is referenced in the update #10624
- fix(index.d.ts): simplify UpdateQuery to avoid "excessively deep and possibly infinite" errors with
extends Document
andany
#10617 - fix(index.d.ts): allow using type: [documentDefinition] when defining a doc array in a schema #10605
- docs: remove useNewUrlParser, useUnifiedTopology, some other legacy options from docs #10631 #10632
- docs(defaults): clarify that setDefaultsOnInsert is true by default in 6.x #10643
- test: use async/await instead of co #10633 AbdelrahmanHafez
v6.0.3
==================
- fix: handle buffering with find() now that find() no longer accepts a callback #10639 #10634 #10610
v6.0.2
==================
- fix(query): handle find() when buffering on initial connection #10610
- fix(populate): get doc schema using $__schema to avoid paths named
schema
#10619 - docs: use async/await in the quickstart #10610
- docs: fix links to guide, schematypes, connections in v5.x docs #10607
- docs: add link to 6.x migration guide to schemas guide #10616
- docs: add migration to 6.x in Migration Guides section #10618 HunterKohler
- docs: fix missing URL part on layout.pug #10622 ItsLhun
v6.0.1
===================
- fix(document): avoid overwriting schema methods when creating a new document with
new Model()
andstrict: false
#11001 - fix(document): avoid overwriting top-level document _id with nested
_id
whenstrict = false
#10934 - fix(collection): avoid double-calling callback on sync error #10956
- fix(connection): handle direct connection to uninitialized replica set that then becomes initialized #10948
- fix(index.d.ts): allow partial updates on subdocuments for defaults #10947
- fix(index.d.ts): handle buffer type in schema definitions #11026
v6.0.0
==================
- Follow the migration guide to get a list of all breaking changes in v6.0.
- BREAKING CHANGE: remove the deprecated safe option in favor of write concerns
- fix: upgrade to mongodb driver 4.1.1
- fix: consistently use $__parent to store subdoc parent as a property, and
$parent()
as a getter function #10584 #10414 - fix: allow calling
countDocuments()
with options
v5.13.17
====================
- fix: backport fix for array filters handling $or and $and #13195 #13192 #10696 raj-goguardian
- fix: update the isIndexEqual function to take into account non-text indexes when checking compound indexes that include both text and non-text indexes #13138 #13136 rdeavila94
v5.13.16
====================
- fix: make access to process.versions lazy #12584 maciasello
- fix(types): add missing type definitions for
bulkSave()
#12019 - docs: backport documentation URL updates #12692 hasezoey
v5.13.15
====================
- fix: backport fix for CVE-2022-2564 #12281 shubanker
- docs: fix broken link from findandmodify method deprecation #11366 laissonsilveira
v5.13.14
====================
- fix(timestamps): avoid setting createdAt on documents that already exist but dont have createdAt #11024
- docs(models): fix up nModified example for 5.x #11055
v5.13.13
====================
- fix: upgrade to mongodb@3.7.3 #10909 gaurav-sharma-gs
- fix: correctly emit end event in before close #10916 iovanom
- fix(index.d.ts): improve ts types for query set #10942 jneal-afs
v5.13.12
====================
- fix(cursor): use stream destroy method on close to prevent emitting duplicate 'close' #10897 iovanom
- fix(index.d.ts): backport streamlining of FilterQuery and DocumentDefinition to avoid "excessively deep and possibly infinite" TS errors #10617
v5.13.11
====================
- fix: upgrade mongodb -> 3.7.2 #10871 winstonralph
- fix(connection): call setMaxListeners(0) on MongoClient to avoid event emitter memory leak warnings with
useDb()
#10732
v5.13.10
====================
- fix(index.d.ts): allow using type: SchemaDefinitionProperty in schema definitions #10674
- fix(index.d.ts): allow AnyObject as param to findOneAndReplace() #10714
v5.13.9
===================
- fix(populate): avoid setting empty array on lean document when populate result is undefined #10599
- fix(document): make depopulate() handle populated paths underneath document arrays #10592
- fix: peg @types/bson version to 1.x || 4.0.x to avoid stubbed 4.2.x release #10678
- fix(index.d.ts): simplify UpdateQuery to avoid "excessively deep and possibly infinite" errors with
extends Document
andany
#10647 - fix(index.d.ts): allow specifying weights as an IndexOption #10586
- fix: upgrade to mpath v0.8.4 re: security issue #10683
v5.13.8
===================
- fix(populate): handle populating subdoc array virtual with sort #10552
- fix(model): check for code instead of codeName when checking for existing collections for backwards compat with MongoDB 3.2 #10420
- fix(index.d.ts): correct value of this for custom query helper methods #10545
- fix(index.d.ts): allow strings for ObjectIds in nested properties #10573
- fix(index.d.ts): add match to VirtualTypeOptions.options #8749
- fix(index.d.ts): allow QueryOptions populate parameter type PopulateOptions #10587 osmanakol
- docs(api): add Document#$where to API docs #10583
v5.13.7
===================
- perf(index.d.ts): loosen up restrictions on ModelType generic for Schema for a ~50% perf improvement when compiling TypeScript and using intellisense #10536 #10515 #10349
- fix(index.d.ts): fix broken
Schema#index()
types #10562 JaredReisinger - fix(index.d.ts): allow using SchemaTypeOptions with array of raw document interfaces #10537
- fix(index.d.ts): define IndexOptions in terms of mongodb.IndexOptions #10563 JaredReisinger
- fix(index.d.ts): improve intellisense for DocumentArray
push()
#10546 - fix(index.d.ts): correct type for expires #10529
- fix(index.d.ts): add Query#model property to ts bindings #10531
- refactor(index.d.ts): make callbacks use the new Callback and CallbackWithoutResult types #10550 thiagokisaki
v5.13.6
===================
- fix: upgrade mongodb driver -> 3.6.11 #10543 maon-fp
- fix(schema): throw more helpful error when defining a document array using a schema from a different copy of the Mongoose module #10453
- fix: add explicit check on constructor property to avoid throwing an error when checking objects with null prototypes #10512
- fix(cursor): make sure to clear stack every 1000 docs when calling
next()
to avoid stack overflow with large batch size #10449 - fix(index.d.ts): allow calling new Model(...) with generic Model param #10526
- fix(index.d.ts): update type declarations of Schema.index method #10538 #10530 Raader
- fix(index.d.ts): add useNewUrlParser and useUnifiedTopology to ConnectOptions #10500
- fix(index.d.ts): add missing type for diffIndexes #10547 bvgusak
- fix(index.d.ts): fixed incorrect type definition for Query's .map function #10544 GCastilho
- docs(schema): add more info and examples to Schema#indexes() docs #10446
- chore: add types property to package.json #10557 thiagokisaki
v5.13.5
===================
- perf(index.d.ts): improve typescript type checking performance #10515 andreialecu
- fix(index.d.ts): fix debug type in MongooseOptions #10510 thiagokisaki
- docs(api): clarify that
depopulate()
with no args depopulates all #10501 gfrancz
v5.13.4
===================
- fix: avoid pulling non-schema paths from documents into nested paths #10449
- fix(update): support overwriting nested map paths #10485
- fix(update): apply timestamps to subdocs that would be newly created by
$setOnInsert
#10460 - fix(map): correctly clone subdocs when calling toObject() on a map #10486
- fix(cursor): cap parallel batchSize for populate at 5000 #10449
- fix(index.d.ts): improve autocomplete for new Model() by making
doc
an object with correct keys #10475 - fix(index.d.ts): add MongooseOptions interface #10471 thiagokisaki
- fix(index.d.ts): make LeanDocument work with PopulatedDoc #10494
- docs(mongoose+connection): correct default value for bufferTimeoutMS #10476
- chore: remove unnecessary 'eslint-disable' comments #10466 thiagokisaki
v5.13.3
===================
- fix(model): avoid throwing error when bulkSave() called on a document with no changes #10437
- fix(timestamps): apply timestamps when creating new subdocs with
$addToSet
and with positional operator #10447 - fix(schema): allow calling Schema#loadClass() with class that has a static getter with no setter #10436
- fix(model): handle re-applying object defaults after explicitly unsetting #10442 semirturgay
- fix: bump mongodb driver -> 3.6.10 #10440 AbdelrahmanHafez
- fix(index.d.ts): consistently use NativeDate instead of Date for Date validators and timestamps functions #10426
- fix(index.d.ts): allow calling
discriminator()
with non-document #10452 #10421 DouglasGabr - fix(index.d.ts): allow passing ResultType generic to Schema#path() #10435
v5.13.2
===================
- fix: hardcode @types/node version for now to avoid breaking changes from DefinitelyTyped/DefinitelyTyped#53669 #10415
- fix(index.d.ts): allow using type: Date with Date paths in SchemaDefinitionType #10409
- fix(index.d.ts): allow extra VirtualTypeOptions for better plugin support #10412
- docs(api): add SchemaArray to docs #10397
- docs(schema+validation): fix broken links #10396
- docs(transactions): add note about creating a connection to transactions docs #10406
v5.13.1
====================
- fix: backport fix for array filters handling $or and $and #13195 #13192 #10696 raj-goguardian
- fix: update the isIndexEqual function to take into account non-text indexes when checking compound indexes that include both text and non-text indexes #13138 #13136 rdeavila94
v5.13.0
===================
- feat(query): add sanitizeProjection option to opt in to automatically sanitizing untrusted query projections #10243
- feat(model): add
bulkSave()
function that saves multiple docs in 1bulkWrite()
#9727 #9673 AbdelrahmanHafez - feat(document): allow passing a list of virtuals or
pathsToSkip
to apply intoObject()
andtoJSON()
#10120 - fix(model): make Model.validate use object under validation as context by default #10360 AbdelrahmanHafez
- feat(document): add support for pathsToSkip in validate and validateSync #10375 AbdelrahmanHafez
- feat(model): add
diffIndexes()
function that calculates what indexessyncIndexes()
will create/drop without actually executing any changes #10362 IslandRhythms - feat(document): avoid using sessions that have ended, so you can use documents that were loaded in the session after calling
endSession()
#10306
v5.12.15
====================
- fix(index.d.ts): add extra TInstanceMethods generic param to
Schema
for cases when we can't infer from Model #10358 - fix(index.d.ts): added typings for near() in model aggregation #10373 tbhaxor
- fix(index.d.ts): correct function signature for
Query#cast()
#10388 lkho - docs(transactions): add import statement #10365 JimLynchCodes
- docs(schema): add missing
discriminatorKey
schema option #10386 #10376 IslandRhythms - docs(index.d.ts): fix typo #10363 houssemchebeb
v5.12.14
====================
- fix(schema): check that schema type is an object when setting isUnderneathDocArray #10361 vmo-khanus
- fix(document): avoid infinite recursion when setting single nested subdoc to array #10351
- fix(populate): allow populating nested path in schema using
Model.populate()
#10335 - fix(drivers): emit operation-start/operation-end events to allow inspecting when operations start and end
- fix(index.d.ts): improve typings for virtuals #10350 thiagokisaki
- fix(index.d.ts): correct constructor type for Document #10328
- fix(index.d.ts): add
ValidationError
as a possible type forValidationError#errors
#10320 IslandRhythms - fix: remove unnecessary async devDependency that's causing npm audit warnings #10281
- docs(typescript): add schemas guide #10308
- docs(model): add options parameter description to
Model.exists()
#10336 Aminoiz
v5.12.13
====================
- perf(document): avoid creating nested paths when running
$getAllSubdocs()
#10275 - fix: make returnDocument option work with
findOneAndUpdate()
#10232 #10231 cnwangjie - fix(document): correctly reset subdocument when resetting a map subdocument underneath a single nested subdoc after save #10295
- perf(query): avoid setting non-null sessions to avoid overhead from $getAllSubdocs() #10275
- perf(document): pre split schematype paths when compiling schema to avoid extra overhead of splitting when hydrating documents #10275
- perf(schema): pre-calculate mapPaths to avoid looping over every path for each path when initing doc #10275
- fix(index.d.ts): drill down into nested arrays when creating LeanDocument type #10293
v5.12.12
====================
- fix(documentarray): retain atomics when setting to a new array #10272
- fix(query+model): fix deprecation warning for
returnOriginal
withfindOneAndUpdate()
#10298 #10297 #10292 #10285 IslandRhythms - fix(index.d.ts): make
map()
result an array if used over an array #10288 quantumsheep
v5.12.11
====================
- fix(populate): skip applying setters when casting arrays for populate() to avoid issues with arrays of immutable elements #10264
- perf(schematype): avoid cloning setters every time we run setters #9588
- perf(get): add benchmarks and extra cases to speed up get() #9588
- perf(array): improve array constructor performance on small arrays to improve nested array perf #9588
- fix(index.d.ts): allow using type: [String] with string[] when using SchemaDefinition with generic #10261
- fix(index.d.ts): support ReadonlyArray as well as regular array where possible in schema definitions #10260
- docs(connection): document noListener option to useDb #10278 stuartpb
- docs: migrate raw tutorial content from pug / JS to markdown #10271
- docs: fix typo #10269 sanjib
v5.12.10
====================
- fix(query): allow setting
defaults
option on result documents from query options #7287 IslandRhythms - fix(populate): handle populating embedded discriminator with custom tiedValue #10231
- fix(document): allow passing space-delimited string of
pathsToValidate
tovalidate()
andvalidateSync()
#10258 - fix(model+schema): support
loadClass()
on classes that havecollection
as a static property #10257 #10254 IslandRhythms - fix(SchemaArrayOptions): correct property name #10236
- fix(index.d.ts): add any to all query operators to minimize likelihood of "type instantiation is excessively deep" when querying docs with 4-level deep subdocs #10189
- fix(index.d.ts): add $parent() in addition to parent() in TS definitions
- fix(index.d.ts): correct async iterator return type for QueryCursor #10253 #10252 #10251 borfig
- fix(index.d.ts): add
virtualsOnly
parameter toloadClass()
function signature IslandRhythms - docs(typescript): add typescript populate docs #10212
- docs: switch from AWS to Azure Functions for search #10244
v5.12.9
===================
- fix(schema): ensure add() overwrites existing schema paths by default #10208 #10203
- fix(schema): support creating nested paths underneath document arrays #10193
- fix(update): convert nested dotted paths in update to nested paths to avoid ending up with dotted properties in update #10200
- fix(document): allow calling validate() and validateSync() with
options
as first parameter #10216 - fix(schema): apply static properties to model when using loadClass() #10206
- fix(index.d.ts): allow returning Promise from middleware functions #10229
- fix(index.d.ts): add pre('distinct') hooks to TypeScript #10192
v5.12.8
===================
- fix(populate): handle populating immutable array paths #10159
- fix(CastError): add
toJSON()
function to ensurename
property always ends up inJSON.stringify()
output #10166 IslandRhythms - fix(query): add allowDiskUse() method to improve setting MongoDB 4.4's new
allowDiskUse
option #10177 - fix(populate): allow populating paths under mixed schematypes where some documents have non-object properties #10191
- chore: remove unnecessary driver dynamic imports so Mongoose can work with Parcel #9603
- fix(index.d.ts): allow any object as parameter to create() and
insertMany()
#10144 - fix(index.d.ts): allow creating Model class with raw interface, no
extends Document
#10144 - fix(index.d.ts): separate UpdateQuery from
UpdateWithAggregationPipeline
for cases whenUpdateQuery
is used as a function param #10186 - fix(index.d.ts): don't require error value in pre/post hooks #10213 michaln-q
- docs(typescript): add a typescript intro tutorial and statics tutorial #10021
- docs(typescript): add query helpers tutorial #10021
- docs(deprecations): add note that you can safely ignore
useFindAndModify
anduseCreateIndex
deprecation warnings #10155 - chore(workflows): add node 16 to github actions #10201 AbdelrahmanHafez
v5.12.7
===================
- fix(document): make $getPopulatedDocs() return populated virtuals #10148
- fix(discriminator): take discriminator schema's single nested paths over base schema's #10157
- fix(discriminator): allow numbers and ObjectIds as tied values for discriminators #10130
- fix(document): avoid double validating paths underneath mixed objects in save() #10141
- fix(schema): allow path() to return single nested paths within document arrays #10164
- fix(model+query): consistently wrap query callbacks in
process.nextTick()
to avoid clean stack traces causing memory leak when using synchronous recursion likeasync.whilst()
#9864 - fix(cursor): correctly report CastError when using noCursorTimeout flag #10150
- fix(index.d.ts): add CastError constructor #10176
- fix(index.d.ts): allow setting mongoose.pluralize(null) in TypeScript #10185
- docs: add link to transactions guide from nav bar #10143
- docs(validation): add section about custom error messages #10140
- docs: make headers linkable via clicking #10156
- docs: broken link in document.js #10190 joostdecock
- docs: make navbar responsive on legacy 2.x docs #10171 ad99526
v5.12.6
===================
- fix(query): allow setting
writeConcern
schema option to work around MongoDB driver'swriteConcern
deprecation warning #10083 #10009 IslandRhythms - fix(populate): dedupe when virtual populate foreignField is an array to avoid duplicate docs in result #10117
- fix(populate): add
localField
filter to$elemMatch
on virtual populate when custommatch
has a$elemMatch
andforeignField
is an array #10117 - fix(query): convert projection string values to numbers as a workaround for #10142
- fix(document): set version key filter on
save()
when usingoptimisticConcurrency
if no changes in document #10128 IslandRhythms - fix(model): use
obj
ascontext
inModel.validate()
ifobj
is a document #10132 - fix(connection): avoid db events deprecation warning when using
useDb()
withuseUnifiedTopology
#8267 - fix: upgrade to sift@13.5.2 to work around transitive dev dependency security warning #10121
- fix(index.d.ts): allow any object as parameter to
create()
andinsertMany()
#10144 - fix(index.d.ts): clarify that
eachAsync()
callback receives a single doc rather than array of docs unlessbatchSize
is set #10135 - fix(index.d.ts): clarify that return value from
validateSync()
is a ValidationError #10147 michaln-q - fix(index.d.ts): add generic type for Model constructor #10074 Duchynko
- fix(index.d.ts): add parameter type in merge #10168 yoonhoGo
Configuration
-
If you want to rebase/retry this MR, check this box.