Skip to content

Commit 64cec02

Browse files
authored
Merge branch 'master' into master
2 parents 5c03f80 + c27500b commit 64cec02

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
7.5.1 / 2023-09-11
2+
==================
3+
* 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)
4+
* fix: avoid unexpected error when accessing null array element on discriminator array when populating #13716 [ZSabakh](https://github.com/ZSabakh)
5+
* types(schematypes): use DocType for instance method this #13822 #13800 [pshaddel](https://github.com/pshaddel)
6+
* types: remove duplicated 'exists' method in Model interface in models.d.ts #13818 [ohzeno](https://github.com/ohzeno)
7+
* docs(model): replace outdated docs on deprecated findOneAndUpdate() overwrite option #13821 #13715
8+
* docs: add example of using `virtuals.pathsToSkip` option for `toObject()` and `toJSON()` #13798 [RobertHunter-Pluto](https://github.com/RobertHunter-Pluto)
9+
110
7.5.0 / 2023-08-29
211
==================
312
* feat: use mongodb driver v5.18.1

lib/model.js

+18-2
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,17 @@ Model.createCollection = async function createCollection(options) {
14511451
* // Will drop the 'age' index and create an index on `name`
14521452
* await Customer.syncIndexes();
14531453
*
1454+
* You should be careful about running `syncIndexes()` on production applications under heavy load,
1455+
* because index builds are expensive operations, and unexpected index drops can lead to degraded
1456+
* performance. Before running `syncIndexes()`, you can use the [`diffIndexes()` function](#Model.diffIndexes())
1457+
* to check what indexes `syncIndexes()` will drop and create.
1458+
*
1459+
* #### Example:
1460+
*
1461+
* const { toDrop, toCreate } = await Model.diffIndexes();
1462+
* toDrop; // Array of strings containing names of indexes that `syncIndexes()` will drop
1463+
* toCreate; // Array of strings containing names of indexes that `syncIndexes()` will create
1464+
*
14541465
* @param {Object} [options] options to pass to `ensureIndexes()`
14551466
* @param {Boolean} [options.background=null] if specified, overrides each index's `background` property
14561467
* @return {Promise}
@@ -1483,9 +1494,14 @@ Model.syncIndexes = async function syncIndexes(options) {
14831494
/**
14841495
* Does a dry-run of `Model.syncIndexes()`, returning the indexes that `syncIndexes()` would drop and create if you were to run `syncIndexes()`.
14851496
*
1497+
* #### Example:
1498+
*
1499+
* const { toDrop, toCreate } = await Model.diffIndexes();
1500+
* toDrop; // Array of strings containing names of indexes that `syncIndexes()` will drop
1501+
* toCreate; // Array of strings containing names of indexes that `syncIndexes()` will create
1502+
*
14861503
* @param {Object} [options]
1487-
* @returns {Promise} which contains an object, {toDrop, toCreate}, which
1488-
* are indexes that would be dropped in MongoDB and indexes that would be created in MongoDB.
1504+
* @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[] }`.
14891505
*/
14901506

14911507
Model.diffIndexes = async function diffIndexes() {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mongoose",
33
"description": "Mongoose MongoDB ODM",
4-
"version": "7.5.0",
4+
"version": "7.5.1",
55
"author": "Guillermo Rauch <[email protected]>",
66
"keywords": [
77
"mongodb",

0 commit comments

Comments
 (0)