Skip to content

Commit

Permalink
Merge pull request #14729 from Automattic/8.5
Browse files Browse the repository at this point in the history
8.5
  • Loading branch information
vkarpov15 authored Jul 8, 2024
2 parents 761e551 + fd3d271 commit 863279d
Show file tree
Hide file tree
Showing 29 changed files with 1,080 additions and 410 deletions.
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
Loading

0 comments on commit 863279d

Please sign in to comment.