Skip to content

Commit

Permalink
Merge branch 'master' into vkarpov15/gh-14719
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jul 9, 2024
2 parents 517f27b + c4c932a commit a860270
Show file tree
Hide file tree
Showing 33 changed files with 1,213 additions and 428 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
8.5.0 / 2024-07-08
==================
* 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](https://github.com/mirasayon)

8.4.5 / 2024-07-05
==================
* types: correct this for validate.validator schematype option #14720 #14696
Expand Down
6 changes: 3 additions & 3 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ const Kitten = connection.model('Kitten', kittySchema);

<a class="anchor" href="#array-defaults">**Q**</a>. How can I change mongoose's default behavior of initializing an array path to an empty array so that I can require real data on document creation?

**A**. You can set the default of the array to a function that returns `undefined`.
**A**. You can set the default of the array to `undefined`.

```javascript
const CollectionSchema = new Schema({
Expand All @@ -329,13 +329,13 @@ const CollectionSchema = new Schema({

<a class="anchor" href="#initialize-array-path-null">**Q**</a>. How can I initialize an array path to `null`?

**A**. You can set the default of the array to a function that returns `null`.
**A**. You can set the default of the array to [`null`](https://masteringjs.io/tutorials/fundamentals/null).

```javascript
const CollectionSchema = new Schema({
field1: {
type: [String],
default: () => { return null; }
default: null
}
});
```
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
</style>

*First be sure you have [MongoDB](http://www.mongodb.org/downloads) and [Node.js](http://nodejs.org/) installed.*
*First be sure you have [MongoDB](https://www.mongodb.com/try/download/community) and [Node.js](http://nodejs.org/en/download) installed.*

Next install Mongoose from the command line using `npm`:

Expand Down
Loading

0 comments on commit a860270

Please sign in to comment.