Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Sep 12, 2023
2 parents 5c03f80 + c27500b commit 64cec02
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
7.5.1 / 2023-09-11
==================
* fix: set default value for _update when no update object is provided and versionKey is set to false #13795 #13783 [MohOraby](https://github.com/MohOraby)
* fix: avoid unexpected error when accessing null array element on discriminator array when populating #13716 [ZSabakh](https://github.com/ZSabakh)
* types(schematypes): use DocType for instance method this #13822 #13800 [pshaddel](https://github.com/pshaddel)
* types: remove duplicated 'exists' method in Model interface in models.d.ts #13818 [ohzeno](https://github.com/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](https://github.com/RobertHunter-Pluto)

7.5.0 / 2023-08-29
==================
* feat: use mongodb driver v5.18.1
Expand Down
20 changes: 18 additions & 2 deletions lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,17 @@ Model.createCollection = async function createCollection(options) {
* // Will drop the 'age' index and create an index on `name`
* await Customer.syncIndexes();
*
* You should be careful about running `syncIndexes()` on production applications under heavy load,
* because index builds are expensive operations, and unexpected index drops can lead to degraded
* performance. Before running `syncIndexes()`, you can use the [`diffIndexes()` function](#Model.diffIndexes())
* to check what indexes `syncIndexes()` will drop and create.
*
* #### Example:
*
* const { toDrop, toCreate } = await Model.diffIndexes();
* toDrop; // Array of strings containing names of indexes that `syncIndexes()` will drop
* toCreate; // Array of strings containing names of indexes that `syncIndexes()` will create
*
* @param {Object} [options] options to pass to `ensureIndexes()`
* @param {Boolean} [options.background=null] if specified, overrides each index's `background` property
* @return {Promise}
Expand Down Expand Up @@ -1483,9 +1494,14 @@ Model.syncIndexes = async function syncIndexes(options) {
/**
* Does a dry-run of `Model.syncIndexes()`, returning the indexes that `syncIndexes()` would drop and create if you were to run `syncIndexes()`.
*
* #### Example:
*
* const { toDrop, toCreate } = await Model.diffIndexes();
* toDrop; // Array of strings containing names of indexes that `syncIndexes()` will drop
* toCreate; // Array of strings containing names of indexes that `syncIndexes()` will create
*
* @param {Object} [options]
* @returns {Promise} which contains an object, {toDrop, toCreate}, which
* are indexes that would be dropped in MongoDB and indexes that would be created in MongoDB.
* @return {Promise<Object>} contains the indexes that would be dropped in MongoDB and indexes that would be created in MongoDB as `{ toDrop: string[], toCreate: string[] }`.
*/

Model.diffIndexes = async function diffIndexes() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mongoose",
"description": "Mongoose MongoDB ODM",
"version": "7.5.0",
"version": "7.5.1",
"author": "Guillermo Rauch <guillermo@learnboost.com>",
"keywords": [
"mongodb",
Expand Down

0 comments on commit 64cec02

Please sign in to comment.