fix(deps): update dependency mongoose to v8
This MR contains the following updates:
Package | Type | Update | Change |
---|---|---|---|
mongoose (source) | dependencies | major | ^5.13.22 -> ^8.6.3 |
Release Notes
Automattic/mongoose (mongoose)
v8.6.3
==================
- fix: make getters convert uuid to string when calling toObject() and toJSON() #14890 #14869
- fix: fix missing Aggregate re-exports for ESM #14886 wongsean
- types(document): add generic param to depopulate() to allow updating properties #14891 #14876
v8.6.2
==================
- fix: make set merge deeply nested objects #14870 #14861 ianHeydoc
- types: allow arbitrary keys in query filters again (revert #14764) #14874 #14863 #14862 #14842
- types: make SchemaType static setters property accessible in TypeScript #14881 #14879
- type(inferrawdoctype): infer Date types as JS dates rather than Mongoose SchemaType Date #14882 #14839
v8.6.1
==================
- fix(document): avoid unnecessary clone() in applyGetters() that was preventing getters from running on 3-level deep subdocuments #14844 #14840 #14835
- fix(model): throw error if bulkSave() did not insert or update any documents #14837 #14763
- fix(cursor): throw error in ChangeStream constructor if changeStreamThunk() throws a sync error #14846
- types(query): add $expr to RootQuerySelector #14845
- docs: update populate.md to fix missing match: { } #14847 makhoulshbeeb
v8.6.0
==================
- feat: upgrade mongodb -> 6.8.0, handle throwing error on closed cursor in Mongoose with
MongooseError
instead ofMongoCursorExhaustedError
#14813 - feat(model+query): support options parameter for distinct() #14772 #8006
- feat(QueryCursor): add getDriverCursor() function that returns the raw driver cursor #14745
- types: change query selector to disallow unknown top-level keys by default #14764 alex-statsig
- types: make toObject() and toJSON() not generic by default to avoid type widening #14819 #12883
- types: avoid automatically inferring lean result type when assigning to explicitly typed variable #14734
v8.5.5
==================
- fix(populate): fix a couple of other places where Mongoose gets the document's _id with getters #14833 #14827 #14759
- fix(discriminator): shallow clone Schema.prototype.obj before merging schemas to avoid modifying original obj #14821
- types: fix schema type based on timestamps schema options value #14829 #14825 ark23CIS
v8.5.4
==================
- fix: add empty string check for collection name passed #14806 Shubham2552
- docs(model): add 'throw' as valid strict value for bulkWrite() and add some more clarification on throwOnValidationError #14809
v8.5.3
==================
- fix(document): call required functions on subdocuments underneath nested paths with correct context #14801 #14788
- fix(populate): avoid throwing error when no result and
lean()
set #14799 #14794 #14759 MohOraby - fix(document): apply virtuals to subdocuments if parent schema has virtuals: true for backwards compatibility #14774 #14771 #14623 #14394
- types: make HydratedSingleSubdocument and HydratedArraySubdocument merge types instead of using & #14800 #14793
- types: support schema type inference based on schema options timestamps as well #14773 #13215 ark23CIS
- types(cursor): indicate that cursor.next() can return null #14798 #14787
- types: allow mongoose.connection.db to be undefined #14797 #14789
- docs: add schema type widening advice #14790 JstnMcBrd
v8.5.2
==================
- perf(clone): avoid further unnecessary checks if cloning a primitive value #14762 #14394
- fix: allow setting document array default to null #14769 #14717 #6691
- fix(model): support session: null option for save() to opt out of automatic session option with transactionAsyncLocalStorage #14744 #14736
- fix(model+document): avoid depopulating manually populated doc as getter value #14760 #14759
- fix: correct shardkey access in buildBulkWriteOps #14753 #14752 adf0nt3s
- fix(query): handle casting $switch in $expr #14755 #14751
- types: allow calling SchemaType.cast() without parent and init parameters #14756 #14748 #9076
- docs: fix a wrong example in v6 migration guide #14758 abdelrahman-elkady
v8.5.1
==================
- perf(model): performance improvements for insertMany() #14724
- fix(model): avoid leaving subdoc defaults on top-level doc when setting subdocument to same value #14728 #14722
- fix(model): handle transactionAsyncLocalStorage option with insertMany() #14743
- types: make _id required on Document type #14735 #14660
- types: fix ChangeStream.close to return a Promise like the driver #14740 orgads
v8.5.0
==================
- perf: memoize toJSON / toObject default options #14672
- feat(document): add $createModifiedPathsSnapshot(), $restoreModifiedPathsSnapshot(), $clearModifiedPaths() #14699 #14268
- feat(query): make sanitizeProjection prevent projecting in paths deselected in the schema #14691
- feat: allow setting array default value to null #14717 #6691
- feat(mongoose): allow drivers to set global plugins #14682
- feat(connection): bubble up monitorCommands events to Mongoose connection if monitorCommands option set #14681 #14611
- fix(document): ensure post('deleteOne') hooks are called when calling save() after subdoc.deleteOne() #14732 #9885
- fix(query): remove count() and findOneAndRemove() from query chaining #14692 #14689
- fix: remove default connection if setting createInitialConnection to false after Mongoose instance created #14679 #8302
- types(models+query): infer return type from schema for 1-level deep nested paths #14632
- types(connection): make transaction() return type match the executor function #14661 #14656
- docs: fix docs links in index.md mirasayon
v8.4.5
==================
- types: correct this for validate.validator schematype option #14720 #14696
- docs(model): note that insertMany() with lean skips applying defaults #14723 #14698
v8.4.4
==================
- perf: avoid unnecesary get() call and use faster approach for converting to string #14673 #14394
- fix(projection): handle projections on arrays in Model.hydrate() projection option #14686 #14680
- fix(document): avoid passing validateModifiedOnly to subdocs so subdocs get fully validating if they're directly modified #14685 #14677
- fix: handle casting primitive array with $elemMatch in bulkWrite() #14687 #14678
- fix(query): cast $pull using embedded discriminator schema when discriminator key is set in filter #14676 #14675
- types(connection): fix return type of withSession() #14690 tt-public
- types: add $documents pipeline stage and fix $unionWith type #14666 nick-statsig
- docs(findoneandupdate): improve example that shows findOneAndUpdate() returning doc before updates were applied #14671 #14670
v8.4.3
8.4.3 / 2024-06-17
- fix: remove 0x flamegraph files from release
v8.4.2
==================
v8.4.1
==================
- fix: pass options to clone instead of get in applyVirtuals #14606 #14543 andrews05
- fix(document): fire pre validate hooks on 5 level deep single nested subdoc when modifying after save() #14604 #14591
- fix: ensure buildBulkWriteOperations target shard if shardKey is set #14622 #14621 matlpriceshape
- types: pass DocType down to subdocuments so HydratedSingleSubdocument and HydratedArraySubdocument toObject() returns correct type #14612 #14601
v8.4.0
==================
- feat: upgrade mongodb -> 6.6.2 #14584
- feat: add transactionAsyncLocalStorage option to opt in to automatically setting session on all transactions #14583 #13889
- feat: handle initially null driver when instantiating Mongoose for Rollup support #14577 #12335
- feat(mongoose): export omitUndefined() helper #14582 #14569
- feat: add Model.listSearchIndexes() #14519 #14450
- feat(connection): add listDatabases() function #14506 #9048
- feat(schema): add schema-level readConcern option to apply default readConcern for all queries #14579 #14511
- fix(error): remove model property from CastError to avoid printing all model properties to console #14568 #14529
- fix(model): make bulkWrite() and insertMany() throw if throwOnValidationError set and all ops invalid #14587 #14572
- fix(document): ensure transform function passed to toObject() options applies to subdocs #14600 #14589
- types: add inferRawDocType helper #13900 #13772
- types(document): make document _id type default to unknown instead of any #14541
v8.3.5
==================
- fix(query): shallow clone $or, $and if merging onto empty query filter #14580 #14567
- types(model+query): pass TInstanceMethods to QueryWithHelpers so populated docs have methods #14581 #14574
- docs(typescript): clarify that setting THydratedDocumentType on schemas is necessary for correct method context #14575 #14573
v8.3.4
==================
- perf(document): avoid cloning options using spread operator for perf reasons #14565 #14394
- fix(query): apply translateAliases before casting to avoid strictMode error when using aliases #14562 #14521
- fix(model): consistent top-level timestamps option for bulkWrite operations #14546 #14536
- docs(connections): improve description of connection creation patterns #14564 #14528
v8.3.3
==================
- perf(document): add fast path for applying non-nested virtuals to JSON #14543
- fix: make hydrate() recursively hydrate virtual populate docs if hydratedPopulatedDocs is set #14533 #14503
- fix: improve timestamps option handling in bulkWrite #14546 #14536 sderrow
- fix(model): make recompileSchema() overwrite existing document array discriminators #14527
- types(schema): correctly infer Array<Schema.Types.*> #14534 #14367
- types(query+populate): apply populate overrides to doc toObject() result #14525 #14441
- types: add null to select override return type for findOne #14545 sderrow
v8.3.2
==================
- fix(populate): avoid match function filtering out null values in populate result #14518 #14494
- types(query): make FilterQuery props resolve to any for generics support #14510 #14473 #14459
- types(DocumentArray): pass DocType generic to Document for correct toJSON() and toObject() return types #14526 #14469
- types(models): fix incorrect bulk write options #14513 emiljanitzek
- docs: add documentation for calling schema.post() with async function #14514 #14305
v8.3.1
==================
- fix(document): make update minimization unset property rather than setting to null #14504 #14445
- fix(model): make Model.recompileSchema() also re-apply discriminators #14500 #14444
- fix(schema): deduplicate idGetter so creating multiple models with same schema doesn't result in multiple id getters #14492
- fix: update kareem -> 2.6.3 for index.d.ts #14508 #14497
- fix(mongoose): make setDriver() update mongoose.model() connections and collections #14505
- types(validation): support function for validator message property, and add support for accessing validator reason #14499 #14496
- docs: remove typo #14501 epmartini
v8.3.0
==================
- feat: use mongodb@6.5.0
- feat(document): add validateAllPaths option to validate() and validateSync() #14467 #14414
- feat: pathsToSave option to save() function #14385 #9583
- feat(query): add options parameter to Query.prototype.sort() #14375 #14365
- feat: add function SchemaType.prototype.validateAll #14434 #6910
- fix: handle array schema definitions with of keyword #14447 #14416
- types: add overwriteMiddlewareResult and skipMiddlewareFunction to types #14328 #14829
v8.2.4
==================
- types(query): bring "getFilter" and "getQuery" in-line with "find" and other types #14463 hasezoey
- types(schema): re-export the defintion for SearchIndexDescription #14464 noseworthy
- docs: removed unused hook from docs #14461 bernardarhia
v8.2.3
==================
- fix(schema): avoid returning string 'nested' as schematype #14453 #14443 #14435
- types(schema): add missing search index types #14449 noseworthy
- types: improve the typing of FilterQuery type to prevent it from only getting typed to any #14436 #14398 #14397
v8.2.2
==================
- fix(model): improve update minimizing to only minimize top-level properties in the update #14437 #14420 #13782
- fix: add Null check in case schema.options['type'][0] is undefined #14431 Atharv-Bobde
- types: consistently infer array of objects in schema as a DocumentArray #14430 #14367
- types: add TypeScript interface for the new PipelineStage - Vector Search - solving issue #14428 #14429 jkorach
- types: add pre and post function types on Query class #14433 #14432 IICarst
- types(model): make bulkWrite() types more flexible to account for casting #14423
- docs: update version support documentation for mongoose 5 & 6 #14427 hasezoey
v8.2.1
==================
- fix(document): make $clone avoid converting subdocs into POJOs #14395 #14353
- fix(connection): avoid unhandled error on createConnection() if on('error') handler registered #14390 #14377
- fix(schema): avoid applying default write concern to operations that are in a transaction #14391 #11382
- types(querycursor): correct cursor async iterator type with populate() support #14384 #14374
- types: missing typescript details on options params of updateMany, updateOne, etc. #14382 #14379 #14378 FaizBShah sderrow
- types: allow Record<string, string> as valid query select argument #14371 sderrow
v8.2.0
==================
- feat(model): add recompileSchema() function to models to allow applying schema changes after compiling #14306 #14296
- feat: add middleware for bulkWrite() and createCollection() #14358 #14263 #7893
- feat(model): add
hydratedPopulatedDocs
option to make hydrate recursively hydrate populated docs #14352 #4727 - feat(connection): add withSession helper #14339 #14330
v8.1.3
==================
- fix: avoid corrupting $set-ed arrays when transaction error occurs #14346 #14340
- fix(populate): handle ref() functions that return a model instance #14343 #14249
- fix: insert version key when using insertMany even if
toObject.versionKey
set to false #14344 - fix(cursor): make aggregation cursor support transform option to match query cursor #14348 #14331
- docs(document): clarify that transform function option applies to subdocs #13757
v8.1.2
==================
- fix: include virtuals in document array toString() output if toObject.virtuals set #14335 #14315
- fix(document): handle setting nested path to spread doc with extra properties #14287 #14269
- fix(populate): call setter on virtual populated path with populated doc instead of undefined #14314
- fix(QueryCursor): remove callback parameter of AggregationCursor and QueryCursor #14299 DevooKim
- types: add typescript support for arbitrary fields for the options parameter of Model functions which are of type MongooseQueryOptions #14342 #14341 FaizBShah
- types(model): correct return type for findOneAndUpdate with includeResultMetadata and lean set #14336 #14303
- types(connection): add type definition for
createCollections()
#14295 #14279 - docs(timestamps): clarify that replaceOne() and findOneAndReplace() overwrite timestamps #14337 #14309
v8.1.1
==================
- fix(model): throw readable error when calling Model() with a string instead of model() #14288 #14281
- fix(document): handle setting nested path to spread doc with extra properties #14287 #14269
- types(query): add back context and setDefaultsOnInsert as Mongoose-specific query options #14284 #14282
- types(query): add missing runValidators back to MongooseQueryOptions #14278 #14275
v8.1.0
==================
- feat: upgrade MongoDB driver -> 6.3.0 #14241 #14189 #14108 #14104
- feat: add Atlas search index helpers to Models and Schemas #14251 #14232
- feat(connection): add listCollections() helper to connections #14257
- feat(schematype): merge rather than overwrite default schematype validators #14124 #14070
- feat(types): support type hints in InferSchemaType #14008 JavaScriptBach
v8.0.4
==================
- fix(update): set CastError path to full path if casting update fails #14161 #14114
- fix: cast error when there is an elemMatch in the and clause #14171 tosaka-n
- fix: allow defining index on base model that applies to all discriminators #14176 peplin
- fix(model): deep clone bulkWrite() updateOne arguments to avoid mutating documents in update #14197 #14164
- fix(populate): handle deselecting _id with array of fields in populate() #14242 #14231
- types(model+query): use stricter typings for updateX(), replaceOne(),deleteX() Model functions #14228 #14204
- types: fix return types for findByIdAndDelete overrides #14196 #14190
- types(schema): add missing omit() method #14235 amitbeck
- types(model): add missing strict property to bulkWrite() top level options #14239
- docs(compatibility): add note that Mongoose 5.13 is fully compatible with MongoDB server 5 #14230 #14149
- docs: add shared schemas guide #14211
- docs: update TLS/SSL guide for Mongoose v8 - MongoDB v6 driver deprecations #14170 andylwelch
- docs: update findOneAndUpdate tutorial to use includeResultMetadata #14208 #14207
- docs: clarify disabling _id on subdocs #14195 #14194
v8.0.3
==================
- fix(schema): avoid creating unnecessary clone of schematype in nested array so nested document arrays use correct constructor #14128 #14101
- docs(connections): add example of registering connection event handlers #14150
- docs(populate): add example of using
refPath
andref
functions #14133 #13834 - types: handle using BigInt global class in schema definitions #14160 #14147
- types: make findOneAndDelete() without options return result doc, not ModifyResult #14153 #14130
- types(model): add no-generic override for insertMany() with options #14152 #13999
- types: add missing Type for applyDefaults #14159 jaypea
v8.0.2
==================
- fix(populate): set populated docs in correct order when populating virtual underneath doc array with justOne #14105
- fix(populate): fix curPath to update appropriately #14099 #14098 csy1204
- types: make property names show up in intellisense for UpdateQuery #14123 #14090
- types(document): correct return type for doc.deleteOne() re: Mongoose 8 breaking change #14110 #14081
- types: correct types for when includeResultMetadata: true is set #14078
- types(models): allow specifying timestamps as inline option for bulkWrite() operations #14112 #14072
- docs: fix rendering of 7.x server compatibility #14086 laupow
- docs(source/api): fix "index.js" -> "mongoose.js" rename #14125
- docs(README): update breaking change version #14126
v8.0.1
==================
- fix: retain key order with aliases when creating indexes with alias #14042 meabed
- fix: handle nonexistent collection with diffIndexes #14029 #14010
- types(model+query): correctly remove count from TypeScript types to reflect removal of runtime support #14076 #14067 #14062
- types: correct
this
parameter for methods and statics #14028 #14027 ruxxzebre - types(model+query): unpack arrays in distinct return type #14047 #14026
- types: add missing Types.UUID typings #14023 #13103 k725
- docs: add mongoose 8 to mongodb server compatibility guide #14064
- docs: fix typo in queries.md #14065 MuhibAhmed
v8.0.0
==================
- docs: add version support notes for Mongoose 8, including EOL date for Mongoose 6
v7.8.1
==================
- fix(query): handle casting $switch in $expr #14761
- docs(mongoose): remove out-of-date callback-based example for mongoose.connect() #14811 #14810
v7.8.0
==================
- feat: add transactionAsyncLocalStorage option to opt in to automatically setting session on all transactions #14744 #14742 #14583 #13889
- types(query): fix usage of "RawDocType" where "DocType" should be passed #14737 hasezoey
v7.7.0
==================
- feat(model): add throwOnValidationError option for opting into getting MongooseBulkWriteError if all valid operations succeed in bulkWrite() and insertMany() #14599 #14587 #14572 #13410
v7.6.13
===================
- fix(query): shallow clone $or and $and array elements to avoid mutating query filter arguments #14614 #14610
- types: pass DocType down to subdocuments so HydratedSingleSubdocument and HydratedArraySubdocument toObject() returns correct type #14612 #14601
- docs(migrating_to_7): add id setter to Mongoose 7 migration guide #14645 #13672
v7.6.12
===================
- fix(array): avoid converting to $set when calling pull() on an element in the middle of the array #14531 #14502
- fix: bump mongodb driver to 5.9.2 #14561 lorand-horvath
- fix(update): cast array of strings underneath doc array with array filters #14605 #14595
v7.6.11
===================
- fix(populate): avoid match function filtering out null values in populate result #14518
- fix(schema): support setting discriminator options in Schema.prototype.discriminator() #14493 #14448
- fix(schema): deduplicate idGetter so creating multiple models with same schema doesn't result in multiple id getters #14492 #14457
v7.6.10
===================
- docs(model): add extra note about lean option for insertMany() skipping casting #14415
- docs(mongoose): add options.overwriteModel details to mongoose.model() docs #14422
v7.6.9
==================
- fix(document): handle embedded recursive discriminators on nested path defined using Schema.prototype.discriminator #14256 #14245
- types(model): correct return type for findByIdAndDelete() #14233 #14190
- docs(connections): add note about using asPromise() with createConnection() for error handling #14364 #14266
- docs(model+query+findoneandupdate): add more details about overwriteDiscriminatorKey option to docs #14264 #14246
v7.6.8
==================
- perf(schema): remove unnecessary lookahead in numeric subpath check
- fix(discriminator): handle reusing schema with embedded discriminators defined using Schema.prototype.discriminator #14202 #14162
- fix(ChangeStream): avoid suppressing errors in closed change stream #14206 #14177
v7.6.7
==================
- fix: avoid minimizing single nested subdocs if they are required #14151 #14058
- fix(populate): allow deselecting discriminator key when populating #14155 #3230
- fix: allow adding discriminators using Schema.prototype.discriminator() to subdocuments after defining parent schema #14131 #14109
- fix(schema): avoid creating unnecessary clone of schematype in nested array so nested document arrays use correct constructor #14128 #14101
- fix(populate): call transform object with single id instead of array when populating a justOne path under an array #14135 #14073
- types: add back mistakenly removed findByIdAndRemove() function signature #14136 #14132
v7.6.6
==================
- perf: avoid double-running setter logic when calling
push()
#14120 #11380 - fix(populate): set populated docs in correct order when populating virtual underneath doc array with justOne #14105 #14018
- fix: bump mongodb driver -> 5.9.1 #14084 #13829 lorand-horvath
- types: allow defining document array using [{ prop: String }] syntax #14095 #13424
- types: correct types for when includeResultMetadata: true is set #14078 #13987 prathamVaidya
- types(query): base filters and projections off of RawDocType instead of DocType so autocomplete doesn't show populate #14118 #14077
- types: make property names show up in intellisense for UpdateQuery #14123 #14090
- types(model): support calling Model.validate() with pathsToSkip option #14088 #14003
- docs: remove "DEPRECATED" warning mistakenly added to read() tags param #13980
v7.6.5
==================
- fix: handle update validators and single nested doc with numeric paths #14066 #13977
- fix: handle recursive schema array in discriminator definition #14068 #14055
- fix: diffIndexes treats namespace error as empty #14048 #14029
- docs(migrating_to_7): add note about requiring new with ObjectId #14021 #14020
v7.6.4
==================
- fix(connection): retain modified status for documents created outside a transaction during transaction retries #14017 #13973
- fix(schema): handle recursive schemas in discriminator definitions #14011 #13978
- fix: handle casting $or underneath $elemMatch #14007 #13974
- fix(populate): allow using options: { strictPopulate: false } to disable strict populate #13863
- docs: fix differences between sample codes and documentation #13998 suzuki
- docs: fix missing import and change wrong variable name #13992 suzuki
v7.6.3
==================
- fix(populate): handle multiple spaces when specifying paths to populate using space-delimited paths #13984 #13951
- fix(update): avoid applying defaults on query filter when upserting with empty update #13983 #13962
- fix(model): add versionKey to bulkWrite when inserting or upserting #13981 #13944
- docs: fix typo in timestamps docs #13976 danielcoker
v7.6.2
==================
- perf: avoid storing a separate entry in schema subpaths for every element in an array #13953 #13874
- fix(document): avoid triggering setter when initializing Model.prototype.collection to allow defining collection as a schema path name #13968 #13956
- fix(model): make bulkSave() save changes in discriminator paths if calling bulkSave() on base model #13959 #13907
- fix(document): allow calling $model() with no args for TypeScript #13963 #13878
- fix(schema): handle embedded discriminators defined using Schema.prototype.discriminator() #13958 #13898
- types(model): make InsertManyResult consistent with return type of insertMany #13965 #13904
- types(models): add cleaner type definitions for insertMany() with no generics to prevent errors when using insertMany() in generic classes #13964 #13957
- types(schematypes): allow defining map path using type: 'Map' in addition to type: Map #13960 #13755
v7.6.1
===================
- fix(query): shallow clone $or and $and array elements to avoid mutating query filter arguments #14614 #14610
- types: pass DocType down to subdocuments so HydratedSingleSubdocument and HydratedArraySubdocument toObject() returns correct type #14612 #14601
- docs(migrating_to_7): add id setter to Mongoose 7 migration guide #14645 #13672
v7.6.0
==================
- feat: upgrade mongodb node driver -> 5.9.0 #13927 #13926 sanguineti
- fix: avoid CastError when passing different value of discriminator key in
$or
#13938 #13906
v7.5.4
==================
- fix: avoid stripping out
id
property when_id
is set #13933 #13892 #13867 - fix(QueryCursor): avoid double-applying schema paths so you can include select: false fields with + projection using cursors #13932 #13773
- fix(query): allow deselecting discriminator key using - syntax #13929 #13760
- fix(query): handle $round in $expr as array #13928 #13881
- fix(document): call pre('validate') hooks when modifying a path underneath triply nested subdoc #13912 #13876
- fix(mongoose): correctly handle global applyPluginsToChildSchemas option #13911 #13887
- types: add insertMany array overload with options #13931 t1bb4r
- docs(compatibility): add Mongoose 7 support to compatibility matrix #13875
- docs: amend some awkward FAQ wording #13925 peteboere
v7.5.3
==================
- fix(document): handle MongoDB Long when casting BigInts #13869 #13791
- fix(model): make bulkSave() persist changes that happen in pre('save') middleware #13885 #13799
- fix: handle casting $elemMatch underneath $not underneath another $elemMatch #13893 #13880
- fix(model): make bulkWrite casting respect global setDefaultsOnInsert #13870 #13823
- fix(document): handle default values for discriminator key with embedded discriminators #13891 #13835
- fix: account for null values when assigning isNew property within document array #13883
- types: avoid "interface can only extend object types with statically known members" error in TypeScript 4 #13871
- docs(deprecations): fix typo in includeResultMetadata deprecation docs #13884 #13844
- docs: fix pre element overflow in home page #13868 ghoshRitesh12
v7.5.2
==================
- fix(schema): handle number discriminator keys when using Schema.prototype.discriminator() #13858 #13788
- fix: ignore
id
property when callingset()
with bothid
and_id
specified to avoidid
setter overwriting #13762 - types: pass correct document type to required and default function #13851 #13797
- docs(model): add examples of using diffIndexes() to syncIndexes()and diffIndexes() api docs #13850 #13771
v7.5.1
==================
- fix: set default value for _update when no update object is provided and versionKey is set to false #13795 #13783 MohOraby
- fix: avoid unexpected error when accessing null array element on discriminator array when populating #13716 ZSabakh
- types(schematypes): use DocType for instance method this #13822 #13800 pshaddel
- types: remove duplicated 'exists' method in Model interface in models.d.ts #13818 ohzeno
- docs(model): replace outdated docs on deprecated findOneAndUpdate() overwrite option #13821 #13715
- docs: add example of using
virtuals.pathsToSkip
option fortoObject()
andtoJSON()
#13798 RobertHunter-Pluto
v7.5.0
==================
- feat: use mongodb driver v5.18.1
- feat: allow top level dollar keys with findOneAndUpdate(), update() for MongoDB 5 #13786
- fix(document): make array getters avoid unintentionally modifying array, defer getters until index access instead #13774
- feat: deprecate
overwrite
option for findOneAndUpdate() #13578 - feat: add pathsToSkip option for Model.validate #13663 #10353
- feat: support alias when declaring index #13659 #13276
- fix(query): remove unnecessary check for atomic operators in findOneAndReplace() #13678
- types: add SearchMeta Interface for Atlas Search #13792 mreouven
- types(schematypes): add missing BigInt SchemaType #13787
v7.4.5
==================
- fix(debug): avoid putting virtuals and getters in debug output #13778
- fix(model): make Model.bulkWrite() with empty array and ordered false not throw an error #13664
- fix(document): correctly handle inclusive/exclusive projections when applying subdocument defaults #13763 #13720
v7.4.4
==================
- fix(connection): reset document state in between transaction retries #13726 #13698
- fix(cursor): bubble up resumeTokenChanged event from change streams #13736 #13607
- fix(query+populate): add refPath to projection by default, unless explicitly excluded #13758
- fix(schema): support 'ascending', 'asc', 'descending', 'desc' for index direction #13761 #13725
- fix(ChangeStream): add _bindEvents to addListener function for observable support #13759 yury-ivaniutsenka
- types: infer return type when using
get()
,markModified()
, etc. with known property name literal #13739 maybesmurf - types: add missing typings for option includeResultMetadata #13747 #13746 Idnan
- types: export InferSchemaType #13737
- docs(middleware): clarify that query middleware applies to document by default #13734 #13713
- docs: add brief note on TypeScript generic usage for embedded discriminator path() calls #13728 #10435
- docs: link v7 migration guide #13742 Cooldogyum
- docs(migrating_to_6): add note about incompatible packages #13733
v7.4.3
==================
- fix: avoid applying map property getters when saving #13704 #13657
- fix(query): allow deselecting discriminator key #13722 #13679
- types(models+query): return lean type when passing QueryOptions with lean: true to relevant model functions like find() and findOne() #13721 #13705
- types(schema): correct return type for Schema.prototype.indexes() #13718 #13702
- types: allow accessing options from pre middleware #13708 #13633
- types: add UpdateQueryKnownOnly type for stricter UpdateQuery type checking #13699 #13630
- types(schema): support required: { isRequired: true } syntax in schema definition #13680
- docs(middleware): clarify that doc.deleteOne() doesn't run query middleware currently #13707 #13669
v7.4.2
==================
- fix(model): avoid hanging on empty bulkWrite() with ordered: false #13684 #13664
- fix: Document.prototype.isModified support for a string of keys as first parameter #13674 #13667 gastoncasini
- fix: disable id virtual if alias:id set #13654 #13650
- fix: support timestamps:false on bulkWrite with updateOne and updateMany #13649 #13611
- docs(typescript): highlight auto type inference for methods and statics, add info on using methods with generics #13696 #12942
- docs(middleware): fix old example using post('remove') #13683 #13518
- docs(deprecations): quick fix for includeResultMetadata docs #13695
v7.4.1
==================
- fix(document): correctly clean up nested subdocs modified state on save() #13644 #13609
- fix(schema): avoid propagating toObject.transform and toJSON.transform option to implicitly created schemas #13634 #13599
- fix: prevent schema options overwriting user defined writeConcern #13612 #13592
- types: correctly handle pre('deleteOne', { document: true }) #13632
- types(schema): handle type: Schema.Types.Map in TypeScript #13628
- types: Add inline comment to to tell the default value of the runValidator flag in the queryOptions types #13636 omran95
- docs: rework several code examples that still use callbacks #13635 #13616
- docs: remove callbacks from validation description #13638 #13501
v7.4.0
==================
- perf: speed up mapOfSubdocs benchmark by 4x by avoiding unnecessary O(n^2) loop in getPathsToValidate() #13614
- feat: upgrade to MongoDB Node.js driver 5.7.0 #13591
- BREAKING CHANGE: add
id
setter which allows modifying_id
by settingid
(Note this change was originally shipped as afeat
, but later reverted in Mongoose 8 due to compatibility issues) #13517 - feat: support generating custom cast error message with a function #13608 #3162
- feat(query): support MongoDB driver's includeResultMetadata option for findOneAndUpdate #13584 #13539
- feat(connection): add Connection.prototype.removeDb() for removing a related connection #13580 #11821
- feat(query): delay converting documents into POJOs until query execution, allow querying subdocuments with defaults disabled #13522
- feat(model): add option "aggregateErrors" for create() #13544 hasezoey
- feat(schema): add collectionOptions option to schemas #13513
- fix: move all MongoDB-specific connection logic into driver layer, add createClient() method to handle creating MongoClient #13542
- fix(document): allow setting keys with dots in mixed paths underneath nested paths #13536
- types: augment bson.ObjectId instead of adding on own type #13515 #12537 hasezoey
- docs(guide): fix md lint #13593 hasezoey
- docs: changed the code from 'await author.save()' to 'await story1.save()' #13596 SomSingh23
v7.3.4
==================
- chore: release 7.4.4 to overwrite accidental publish of 5.13.20 to latest tag
v7.3.3
==================
- fix: avoid prototype pollution on init
- fix(document): clean up all array subdocument modified paths on save() #13589 #13582
- types: avoid unnecessary MergeType<> if TOverrides not set, clean up statics and insertMany() type issues #13577 #13529
v7.3.2
==================
- fix(model): avoid TypeError if insertMany() fails with error that does not have writeErrors property #13579 #13531
- fix(query): convert findOneAndUpdate to findOneAndReplace when overwrite set for backwards compat with Mongoose 6 #13572 #13550
- fix(query): throw readable error when executing a Query instance without an associated model #13571 #13570
- types: support mongoose.Schema.ObjectId as alias for mongoose.Schema.Types.ObjectId #13543 #13534
- docs(connections): clarify that socketTimeoutMS now defaults to 0 #13576 #13537
- docs(migrating_to_7): add mapReduce() removal to migration guide #13568 #13548
- docs(schemas): fix typo in schemas.md #13540 Metehan-Altuntekin
v7.3.1
==================
- fix(query): respect query-level strict option on findOneAndReplace() #13516 #13507
- docs(connections): expand docs on serverSelectionTimeoutMS #13533 #12967
- docs: add example of accessing save options in pre save #13498
- docs(connections+faq): add info on localhost vs 127.0.0.1
- docs(SchemaType): validate members are validator & message (not msg) #13521 lorand-horvath
v7.3.0
==================
- feat: upgrade mongodb -> 5.6.0 #13455 lorand-horvath
- feat(aggregate): add Aggregate.prototype.finally() to be consistent with Promise API for TypeScript #13509
- feat(schema): support selecting subset of fields to apply optimistic concurrency to #13506 #10591
- feat(model): add
ordered
option toModel.create()
#13472 #4038 - feat(schema): consistently add .get() function to all SchemaType classes
- feat(populate): pass virtual to match function to allow merging match options #13477 #12443
- types: allow overwriting Paths in select() to tell TypeScript which fields are projected #13478 #13224
- types(schema): add validateModifiedOnly as schema option #13503 #10153
- docs: add note about validateModifiedOnly as a schema option #13503 #10153
- docs(migrating_to_7): update migrating_to_7.md to include Model.countDocuments #13508 Climax777
- docs(further_reading): remove style for "img" hasezoey
v7.2.4
==================
v7.2.3
==================
- fix(model): ignore falsy last argument to create() for backwards compatibility #13493 #13491 #13487 MohOraby
- types: remove generic param that's causing issues for typegoose #13494 #13482
- types(aggregate): allow object syntax for $mergeObjects #13470 #13060
- docs(connection): clarify how Connection.prototype.destroy() is different from close() #13475
- docs(populate): fix accidental removal of text #13480
- docs: add additional notes for Atlas X.509 authentication #13452 alexbevi
- docs(populate): add a little more info on why we recommend using ObjectId for _id #13474 #13400
v7.2.2
==================
- fix(schema): make bulkWrite updateOne() and updateMany() respect timestamps option when set by merging schemas #13445
- fix(schema): recursively copy schemas from different modules when calling new Schema() #13441 #13275
- fix(update): allow setting paths with dots under non-strict paths #13450 #13434
- types: improve function parameter types for ToObjectOptions transform option #13446 #13421
- docs: add nextjs page with link to next starter app and couple FAQs #13444 #13430
- docs(connections): add section on multi tenant #13449 #11187
- docs(connection+model): expand docs on accessors for underlying collections #13448 #13334
v7.2.1
==================
- fix(array): track correct changes when setting nested array of primitives #13422 #13372
- fix(query): handle plus path in projection with findOneAndUpdate() #13437 #13413
- fix(cursor): handle calling skipMiddlewareFunction() in pre('find') middleware with cursors #13436 #13411
- fix(model): include inspect output in castBulkWrite() error #13426
- fix: avoid setting null property when updating using update pipeline with child timestamps but no top-level timestamps #13427 #13379
- docs: remove callback based examples #13433 #13401
- docs(connections): add details about keepAlive deprecation #13431
- docs: add list of supported patterns for error message templating #13425 #13311
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.13.3
v6.13.2
===================
v6.13.1
===================
7.x
v6.13.0
===================
- feat(model): add throwOnValidationError option for opting into getting MongooseBulkWriteError if all valid operations succeed in bulkWrite() and insertMany() #14599 #14587 #14572 #13410
v6.12.9
===================
- fix(cast): cast $comment to string in query filters #14590 #14576
- types(model): allow passing strict type checking override to create() #14571 #14548
v6.12.8
===================
- fix(document): handle virtuals that are stored as objects but getter returns string with toJSON #14468 #14446
- fix(schematype): consistently set wasPopulated to object with
value
property rather than boolean #14418 - docs(model): add extra note about lean option for insertMany() skipping casting #14415 #14376
v6.12.7
===================
- perf(model): make insertMany() lean option skip hydrating Mongoose docs #14376 #14372
- perf(document+schema): small optimizations to make init() faster #14383 #14113
- fix(connection): don't modify passed options object to
openUri()
#14370 #13376 #13335 - fix(ChangeStream): bubble up resumeTokenChanged changeStream event #14355 #14349 3150
v6.12.6
===================
- fix(collection): correctly handle buffer timeouts with find() #14277
- fix(document): allow calling push() with different $position arguments #14254
v6.12.5
===================
- perf(schema): remove unnecessary lookahead in numeric subpath check
- fix(document): allow setting nested path to null #14226
- fix(document): avoid flattening dotted paths in mixed path underneath nested path #14198 #14178
- fix: add ignoreAtomics option to isModified() for better backwards compatibility with Mongoose 5 #14213
v6.12.4
===================
- fix: upgrade mongodb driver -> 4.17.2
- fix(document): avoid treating nested projection as inclusive when applying defaults #14173 #14115
- fix: account for null values when assigning isNew property #14172 #13883
v6.12.3
===================
- fix(ChangeStream): correctly handle hydrate option when using change stream as stream instead of iterator #14052
- fix(schema): fix dangling reference to virtual in tree after
removeVirtual()
#14019 #13085 - fix(document): avoid unmarking modified on nested path if no initial value stored and already modified #14053 #14024
- fix(document): consistently avoid marking subpaths of nested paths as modified #14053 #14022
v6.12.2
===================
- fix: add fullPath to ValidatorProps #13995 Freezystem
v6.12.1
===================
- fix(mongoose): correctly handle global applyPluginsToChildSchemas option #13945 #13887 hasezoey
- fix: Document.prototype.isModified support for a string of keys as first parameter #13940 #13674 k-chop
v6.12.0
===================
- feat: use mongodb driver v4.17.1
- fix(model): make Model.bulkWrite() with empty array and ordered false not throw an error #13664
- fix(document): correctly handle inclusive/exclusive projections when applying subdocument defaults #13763 #13720
v6.11.6
===================
- fix(model): avoid hanging on empty bulkWrite() with ordered: false #13701 #13684 JavaScriptBach
- types: augment bson.ObjectId instead of adding on own type #13515 #12537 hasezoey
v6.11.5
===================
- fix(schema): make Schema.prototype.clone() avoid creating different copies of subdocuments and single nested paths underneath single nested paths #13671 #13626
- fix: custom debug function not processing all args #13418
v6.11.4
===================
- perf: speed up mapOfSubdocs benchmark by 4x by avoiding unnecessary O(n^2) loop in getPathsToValidate() #13614
v6.11.3
===================
- fix: avoid prototype pollution on init
- fix(schema): correctly handle uuids with populate() #13317 #13595
v6.11.2
===================
v6.11.1
===================
- fix(query): apply schema-level paths before calculating projection for findOneAndUpdate() #13348 #13340
- fix: add SUPPRESS_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 DEPRECATED 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
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this MR and you won't be reminded about this update again.
- [ ] If you want to rebase/retry this MR, check this box
This MR has been generated by Renovate Bot.