Skip to content

fix(deps): update dependency mongoose to v8

Renovate requested to merge renovate/mongoose-8.x into staging

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

Compare Source

==================

v8.6.2

Compare Source

==================

v8.6.1

Compare Source

==================

  • 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

Compare Source

==================

  • feat: upgrade mongodb -> 6.8.0, handle throwing error on closed cursor in Mongoose with MongooseError instead of MongoCursorExhaustedError #​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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v8.5.2

Compare Source

==================

v8.5.1

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v8.4.4

Compare Source

==================

  • 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

Compare Source

8.4.3 / 2024-06-17

  • fix: remove 0x flamegraph files from release

v8.4.2

Compare Source

==================

v8.4.1

Compare Source

==================

v8.4.0

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v8.3.1

Compare Source

==================

  • 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

Compare Source

==================

v8.2.4

Compare Source

==================

v8.2.3

Compare Source

==================

v8.2.2

Compare Source

==================

v8.2.1

Compare Source

==================

v8.2.0

Compare Source

==================

v8.1.3

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v8.0.4

Compare Source

==================

  • 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

Compare Source

==================

  • 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 and ref 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

Compare Source

==================

  • 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

Compare Source

==================

v8.0.0

Compare Source

==================

  • docs: add version support notes for Mongoose 8, including EOL date for Mongoose 6

v7.8.1

Compare Source

==================

  • 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

Compare Source

==================

v7.7.0

Compare Source

==================

  • 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

Compare Source

===================

  • 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

Compare Source

===================

v7.6.11

Compare Source

===================

  • 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

Compare Source

===================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v7.6.5

Compare Source

==================

v7.6.4

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

===================

  • 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

Compare Source

==================

v7.5.4

Compare Source

==================

v7.5.3

Compare Source

==================

  • 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

Compare Source

==================

  • fix(schema): handle number discriminator keys when using Schema.prototype.discriminator() #​13858 #​13788
  • fix: ignore id property when calling set() with both id and _id specified to avoid id 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

Compare Source

==================

  • 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 for toObject() and toJSON() #​13798 RobertHunter-Pluto

v7.5.0

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v7.4.1

Compare Source

==================

  • 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

Compare Source

==================

  • 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 setting id (Note this change was originally shipped as a feat, 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

Compare Source

==================

  • chore: release 7.4.4 to overwrite accidental publish of 5.13.20 to latest tag

v7.3.3

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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 to Model.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

Compare Source

==================

v7.2.3

Compare Source

==================

v7.2.2

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v7.1.1

Compare Source

==================

v7.1.0

Compare Source

==================

v7.0.5

Compare Source

==================

  • 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

Compare Source

==================

v7.0.3

Compare Source

==================

v7.0.2

Compare Source

==================

v7.0.1

Compare Source

==================

v7.0.0

Compare Source

==================

  • 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

Compare Source

v6.13.2

Compare Source

===================

  • fix(document): make set() respect merge option on deeply nested objects #​14870 #​14878

v6.13.1

Compare Source

===================

7.x

v6.13.0

Compare Source

===================

  • 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

Compare Source

===================

v6.12.8

Compare Source

===================

  • 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

Compare Source

===================

v6.12.6

Compare Source

===================

  • fix(collection): correctly handle buffer timeouts with find() #​14277
  • fix(document): allow calling push() with different $position arguments #​14254

v6.12.5

Compare Source

===================

  • 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

Compare Source

===================

  • 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

Compare Source

===================

  • 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

Compare Source

===================

v6.12.1

Compare Source

===================

v6.12.0

Compare Source

===================

  • 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

Compare Source

===================

v6.11.5

Compare Source

===================

  • 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

Compare Source

===================

  • perf: speed up mapOfSubdocs benchmark by 4x by avoiding unnecessary O(n^2) loop in getPathsToValidate() #​13614

v6.11.3

Compare Source

===================

  • fix: avoid prototype pollution on init
  • fix(schema): correctly handle uuids with populate() #​13317 #​13595

v6.11.2

Compare Source

===================

v6.11.1

Compare Source

===================

  • 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

Compare Source

===================

v6.10.5

Compare Source

===================

  • 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

Compare Source

===================

  • 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

Compare Source

===================

v6.10.2

Compare Source

===================

  • 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 in package.json #​13124 lorand-horvath
  • docs: quick improvement to Model.init() docs #​13054

v6.10.1

Compare Source

===================

v6.10.0

Compare Source

===================

v6.9.3

Compare Source

==================

v6.9.2

Compare Source

==================

v6.9.1

Compare Source

==================

  • 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

Compare Source

==================

v6.8.4

Compare Source

==================

v6.8.3

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v6.8.0

Compare Source

==================

v6.7.5

Compare Source

==================

v6.7.4

Compare Source

==================

v6.7.3

Compare Source

==================

v6.7.2

Compare Source

==================

v6.7.1

Compare Source

==================

v6.7.0

Compare Source

==================

  • 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

Compare Source

==================

v6.6.6

Compare Source

==================

v6.6.5

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v6.6.2

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v6.5.5

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v6.5.2

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v6.4.6

Compare Source

==================

  • 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

Compare Source

==================

v6.4.4

Compare Source

==================

v6.4.3

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v6.3.9

Compare Source

==================

  • 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

Compare Source

==================

  • fix: revert 670b445 perf optimizations that caused some test failures #​11541

v6.3.7

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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() and hint with findOneAndUpdate() #​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

Compare Source

==================

  • 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 and replaceOne #​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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

v6.2.11

Compare Source

===================

  • 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

Compare Source

===================

v6.2.9

Compare Source

==================

v6.2.8

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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 and foreignField 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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 for toJSON() but not toObject() #​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

Compare Source

==================

v6.2.1

Compare Source

===================

  • 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

Compare Source

==================

  • 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

Compare Source

===================

  • fix(mongoose): correctly handle destructured isValidObjectId #​11304
  • fix(mongoose): defer to MongoDB driver isValid() for isValidObjectId() #​11227

v6.1.9

Compare Source

==================

  • 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

Compare Source

==================

v6.1.7

Compare Source

==================

  • 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

Compare Source

==================

  • 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 when versionKey: 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

===================

  • fix(mongoose): correctly handle destructured isValidObjectId #​11304
  • fix(mongoose): defer to MongoDB driver isValid() for isValidObjectId() #​11227

v6.1.0

Compare Source

==================

v6.0.15

Compare Source

===================

  • fix(document): avoid overwriting schema methods when creating a new document with new Model() and strict: false #​11001
  • fix(document): avoid overwriting top-level document _id with nested _id when strict = 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

Compare Source

===================

  • 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

Compare Source

===================

  • 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

Compare Source

===================

  • 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() and deleteMany() docs to reflect new matchedCount, 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

Compare Source

===================

  • 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

Compare Source

===================

  • 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() and findByIdAndUpdate() #​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

Compare Source

==================

  • 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

Compare Source

==================

  • 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 custom typeKey #​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

Compare Source

==================

  • 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 using user option to connect() #​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

Compare Source

==================

  • 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

Compare Source

==================

  • 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

Compare Source

==================

  • 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 and any #​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

Compare Source

==================

v6.0.2

Compare Source

==================

  • 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

Compare Source

===================

  • fix(document): avoid overwriting schema methods when creating a new document with new Model() and strict: false #​11001
  • fix(document): avoid overwriting top-level document _id with nested _id when strict = 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

Compare Source

==================

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

Merge request reports

Loading