Skip to content

Commit 6e8e06b

Browse files
committed
Merge branch '8.0' into vkarpov15/gh-4292-2
2 parents d808a54 + b8d40f1 commit 6e8e06b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+350
-184
lines changed

.github/workflows/benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-20.04
2323
name: Benchmark TypeScript Types
2424
steps:
25-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
25+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
2626
with:
2727
fetch-depth: 0
2828
- name: Setup node

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
steps:
2323
- name: Checkout repository
24-
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
24+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
2525

2626
# Initializes the CodeQL tools for scanning.
2727
- name: Initialize CodeQL

.github/workflows/documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-latest
2929
name: Lint Markdown files
3030
steps:
31-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
31+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
3232

3333
- name: Setup node
3434
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
@@ -48,7 +48,7 @@ jobs:
4848
runs-on: ubuntu-20.04
4949
name: Test Generating Docs
5050
steps:
51-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
51+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
5252
- run: git fetch --depth=1 --tags # download all tags for documentation
5353

5454
- name: Setup node

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323
name: Lint JS-Files
2424
steps:
25-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
25+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
2626

2727
- name: Setup node
2828
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
@@ -58,7 +58,7 @@ jobs:
5858
MONGOMS_PREFER_GLOBAL_PATH: 1
5959
FORCE_COLOR: true
6060
steps:
61-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
61+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
6262

6363
- name: Setup node
6464
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
@@ -94,7 +94,7 @@ jobs:
9494
MONGOMS_PREFER_GLOBAL_PATH: 1
9595
FORCE_COLOR: true
9696
steps:
97-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
97+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
9898
- name: Setup node
9999
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
100100
with:
@@ -122,7 +122,7 @@ jobs:
122122
env:
123123
FORCE_COLOR: true
124124
steps:
125-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
125+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
126126
- name: Setup node
127127
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
128128
with:
@@ -139,6 +139,6 @@ jobs:
139139
contents: read
140140
steps:
141141
- name: Check out repo
142-
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
142+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
143143
- name: Dependency review
144144
uses: actions/dependency-review-action@v3

.github/workflows/tidelift-alignment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
if: github.repository == 'Automattic/mongoose'
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
18+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
1919
- name: Setup node
2020
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
2121
with:

.github/workflows/tsd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323
name: Lint TS-Files
2424
steps:
25-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
25+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
2626

2727
- name: Setup node
2828
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
@@ -40,7 +40,7 @@ jobs:
4040
runs-on: ubuntu-latest
4141
name: Test Typescript Types
4242
steps:
43-
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
43+
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
4444

4545
- name: Setup node
4646
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
7.5.4 / 2023-10-04
2+
==================
3+
* fix: avoid stripping out `id` property when `_id` is set #13933 #13892 #13867
4+
* fix(QueryCursor): avoid double-applying schema paths so you can include select: false fields with + projection using cursors #13932 #13773
5+
* fix(query): allow deselecting discriminator key using - syntax #13929 #13760
6+
* fix(query): handle $round in $expr as array #13928 #13881
7+
* fix(document): call pre('validate') hooks when modifying a path underneath triply nested subdoc #13912 #13876
8+
* fix(mongoose): correctly handle global applyPluginsToChildSchemas option #13911 #13887
9+
* types: add insertMany array overload with options #13931 [t1bb4r](https://github.com/t1bb4r)
10+
* docs(compatibility): add Mongoose 7 support to compatibility matrix #13875
11+
* docs: amend some awkward FAQ wording #13925 [peteboere](https://github.com/peteboere)
12+
113
7.5.3 / 2023-09-25
214
==================
315
* fix(document): handle MongoDB Long when casting BigInts #13869 #13791

docs/compatibility.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Below are the [semver](http://semver.org/) ranges representing which versions of
1818

1919
| MongoDB Server | Mongoose |
2020
| :------------: | :---------------------------: |
21+
| `7.x` | `^7.4.0` |
2122
| `6.x` | `^6.5.0 \| ^7.0.0` |
2223
| `5.x` | `^6.0.0 \| ^7.0.0` |
2324
| `4.4.x` | `^5.10.0 \| ^6.0.0 \| ^7.0.0` |

docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ is undefined on the underlying [POJO](guide.html#minimize).
139139

140140
<a class="anchor" href="#arrow-functions">**Q**</a>. I'm using an arrow function for a [virtual](guide.html#virtuals), [middleware](middleware.html), [getter](api/schematype.html#schematype_SchemaType-get)/[setter](api/schematype.html#schematype_SchemaType-set), or [method](guide.html#methods) and the value of `this` is wrong.
141141

142-
**A**. Arrow functions [handle the `this` keyword much differently than conventional functions](https://masteringjs.io/tutorials/fundamentals/arrow#why-not-arrow-functions).
142+
**A**. Arrow functions [handle the `this` keyword differently than conventional functions](https://masteringjs.io/tutorials/fundamentals/arrow#why-not-arrow-functions).
143143
Mongoose getters/setters depend on `this` to give you access to the document that you're writing to, but this functionality does not work with arrow functions. Do **not** use arrow functions for mongoose getters/setters unless do not intend to access the document in the getter/setter.
144144

145145
```javascript

docs/migrating_to_8.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ If you're still on Mongoose 6.x or earlier, please read the [Mongoose 6.x to 7.x
1616
* [MongoDB Node Driver 6.0](#mongodb-node-driver-6)
1717
* [Removed `findOneAndRemove()`](#removed-findoneandremove)
1818
* [Removed id Setter](#removed-id-setter)
19+
* [Allow `null` For Optional Fields in TypeScript](#allow-null-for-optional-fields-in-typescript)
1920

2021
<h2 id="removed-rawresult-option-for-findoneandupdate"><a href="#removed-rawresult-option-for-findoneandupdate">Removed <code>rawResult</code> option for <code>findOneAndUpdate()</code></a></h2>
2122

@@ -59,4 +60,20 @@ Use `findOneAndDelete()` instead.
5960
<h2 id="removed-id-setter"><a href="#removed-id-setter">Removed id Setter</a></h2>
6061

6162
In Mongoose 7.4, Mongoose introduced an `id` setter that made `doc.id = '0'.repeat(24)` equivalent to `doc._id = '0'.repeat(24)`.
62-
In Mongoose 8, that setter is now removed.
63+
In Mongoose 8, that setter is now removed.
64+
65+
<h2 id="allow-null-for-optional-fields-in-typescript"><a href="#allow-null-for-optional-fields-in-typescript">Allow <code>null</code> For Optional Fields in TypeScript</a></h2>
66+
67+
In Mongoose 8, automatically inferred schema types in TypeScript allow `null` for optional fields.
68+
In Mongoose 7, optional fields only allowed `undefined`, not `null`.
69+
70+
```typescript
71+
const schema = new Schema({ name: String });
72+
const TestModel = model('Test', schema);
73+
74+
const doc = new TestModel();
75+
76+
// In Mongoose 8, this type is `string | null | undefined`.
77+
// In Mongoose 7, this type is `string | undefined`
78+
doc.name;
79+
```

0 commit comments

Comments
 (0)