Skip to content

Commit 165138f

Browse files
Merge remote-tracking branch 'upstream/csfle' into NODE-6507-generate-schema-maps
2 parents 6374139 + 19c0132 commit 165138f

Some content is hidden

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

80 files changed

+2081
-419
lines changed

.github/workflows/benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
with:
2727
fetch-depth: 0
2828
- name: Setup node
29-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
29+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
3030
with:
3131
node-version: 22
3232

.github/workflows/documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3232

3333
- name: Setup node
34-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
34+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
3535
with:
3636
node-version: 22
3737

@@ -52,7 +52,7 @@ jobs:
5252
- run: git fetch --depth=1 --tags # download all tags for documentation
5353

5454
- name: Setup node
55-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
55+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
5656
with:
5757
node-version: 22
5858

.github/workflows/encryption-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424
env:
2525
FORCE_COLOR: true
2626
steps:
27-
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
27+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2828
- name: Setup node
29-
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
29+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
3030
with:
3131
node-version: 22
3232
- name: Install Dependencies

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2626

2727
- name: Setup node
28-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
28+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
2929
with:
3030
node-version: 22
3131

@@ -61,7 +61,7 @@ jobs:
6161
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6262

6363
- name: Setup node
64-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
64+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
6565
with:
6666
node-version: ${{ matrix.node }}
6767

@@ -96,7 +96,7 @@ jobs:
9696
steps:
9797
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
9898
- name: Setup node
99-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
99+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
100100
with:
101101
node-version: 22
102102
- name: Load MongoDB binary cache
@@ -124,7 +124,7 @@ jobs:
124124
steps:
125125
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
126126
- name: Setup node
127-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
127+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
128128
with:
129129
node-version: 22
130130
- run: npm install

.github/workflows/tidelift-alignment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Checkout
1818
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1919
- name: Setup node
20-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
20+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
2121
with:
2222
node-version: 22
2323
- name: Alignment

.github/workflows/tsd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2424

2525
- name: Setup node
26-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
26+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
2727
with:
2828
node-version: 22
2929

@@ -41,7 +41,7 @@ jobs:
4141
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4242

4343
- name: Setup node
44-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
44+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
4545
with:
4646
node-version: 22
4747

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ list.out
7070

7171
data
7272
*.pid
73+
mo-expansion*

CHANGELOG.md

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,68 @@
1+
8.12.1 / 2025-03-04
2+
===================
3+
* fix: match bson version with mongodb's bson version #15297 [hasezoey](https://github.com/hasezoey)
4+
5+
8.12.0 / 2025-03-03
6+
===================
7+
* feat: bump mongodb driver to 6.14
8+
* feat: expose "SchemaTypeOptions" in browser #15277 [hasezoey](https://github.com/hasezoey)
9+
* docs: update field-level-encryption.md #15272 [dphrag](https://github.com/dphrag)
10+
11+
8.11.0 / 2025-02-26
12+
===================
13+
* feat(model): make bulkWrite results include MongoDB bulk write errors as well as validation errors #15271 #15265
14+
* feat(document): add schemaFieldsOnly option to toObject() and toJSON() #15259 #15218
15+
* feat: introduce populate ordered option for populating in series rather than in parallel for transactions #15239 #15231 #15210
16+
* fix(bigint): throw error when casting BigInt that's outside of the bounds of what MongoDB can safely store #15230 #15200
17+
18+
8.10.2 / 2025-02-25
19+
===================
20+
* fix(model+connection): return MongoDB BulkWriteResult instance even if no valid ops #15266 #15265
21+
* fix(debug): avoid printing trusted symbol in debug output #15267 #15263
22+
* types: make type inference logic resilient to no Buffer type due to missing @types/node #15261
23+
24+
8.10.1 / 2025-02-14
25+
===================
26+
* perf(document): only call undoReset() 1x/document #15257 #15255
27+
* perf(schema): clear childSchemas when overwriting existing path to avoid performance degradations #15256 #15253
28+
* perf: some more micro optimizations for find() and findOne() #14906 #15250
29+
* fix(model): avoid adding timeout on Model.init() buffering to avoid unintentional dangling open handles #15251 #15241
30+
* fix: avoid connection buffering on init if autoCreate: false #15247 #15241
31+
* fix: infer discriminator key if set in $set with overwriteDiscriminatorKey #15243 #15218
32+
* types(middleware): make this in document middleware the hydrated doc type, not raw doc type #15246 #15242
33+
* types(schema): support options parameter to Schema.prototype.discriminator() #15249 #15244
34+
* types(schema): allow calling Schema.prototype.number() with no message arg #15237 #15236
35+
* docs(typescript): recommend using HydratedSingleSubdocument over Types.Subdocument #15240 #15211
36+
37+
8.10.0 / 2025-02-05
38+
===================
39+
* feat(schema+schematype): add toJSONSchema() method to convert schemas and schematypes to JSON schema #15184 #11162
40+
* feat(connection): make connection helpers respect bufferTimeoutMS #15229 #15201
41+
* feat(document): support schematype-level transform option #15163 #15084
42+
* feat(model): add insertOne() function to insert a single doc #15162 #14843
43+
* feat(connection): support Connection.prototype.aggregate() for db-level aggregations #15153
44+
* feat(model): make syncIndexes() not call createIndex() on indexes that already exist #15175 #12250
45+
* feat(model): useConnection(connection) function #14802
46+
* fix(model): disallow updateMany(update) and fix TypeScript types re: updateMany() #15199 #15190
47+
* fix(collection): avoid buffering if creating a collection during a connection interruption #15187 #14971
48+
* fix(model): throw error if calling create() with multiple docs in a transaction unless ordered: true #15100
49+
* fix(model): skip createCollection() in syncIndexes() if autoCreate: false #15155
50+
* fix(model): make `hydrate()` handle hydrating deeply nested populated docs with hydratedPopulatedDocs #15130
51+
* types(document): make sure toObject() and toJSON() apply versionKey __v #15097
52+
* ci(NODE-6505): CI Setup for Encryption Support #15139 [aditi-khare-mongoDB](https://github.com/aditi-khare-mongoDB)
53+
54+
8.9.7 / 2025-02-04
55+
==================
56+
* fix: avoid applying defaults on map embedded paths #15217 #15196
57+
* types: add missing $median operator to aggregation types #15233 #15209
58+
* docs(document): clarify that toObject() returns a POJO that may contain non-POJO values #15232 #15208
59+
60+
8.9.6 / 2025-01-31
61+
==================
62+
* fix(document): allow setting values to undefined with set(obj) syntax with strict: false #15207 #15192
63+
* fix(schema): improve reason for UUID cast error, currently a TypeError #15215 #15202
64+
* fix(aggregate): improve error when calling near() with invalid coordinates #15206 #15188
65+
166
7.8.6 / 2025-01-20
267
===================
368
* chore: remove coverage output from bundle
@@ -94,8 +159,6 @@
94159
* fix: disallow using $where in match
95160
* perf: cache results from getAllSubdocs() on saveOptions, only loop through known subdoc properties #15055 #15029
96161
* fix(model+query): support overwriteDiscriminatorKey for bulkWrite updateOne and updateMany, allow inferring discriminator key from update #15046 #15040
97-
=======
98-
>>>>>>> 7.x
99162

100163
7.8.3 / 2024-11-26
101164
==================

docs/field-level-encryption.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ Keep in mind that the following example is a simple example to help you get star
3939
The encryption key in the following example is insecure; MongoDB recommends using a [KMS](https://www.mongodb.com/docs/v5.0/core/security-client-side-encryption-key-management/).
4040

4141
```javascript
42-
const { ClientEncryption } = require('mongodb-client-encryption');
42+
const { ClientEncryption } = require('mongodb');
4343
const mongoose = require('mongoose');
44-
const { Binary } = require('mongodb');
4544

4645
run().catch(err => console.log(err));
4746

@@ -66,12 +65,14 @@ async function run() {
6665
kmsProviders
6766
}
6867
}).asPromise();
69-
const encryption = new ClientEncryption(conn.client, {
68+
const encryption = new ClientEncryption(conn.getClient(), {
7069
keyVaultNamespace,
7170
kmsProviders,
7271
});
7372

74-
const _key = await encryption.createDataKey('local');
73+
const _key = await encryption.createDataKey('local', {
74+
keyAltNames: ['exampleKeyName'],
75+
});
7576
}
7677
```
7778

docs/schematypes.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -654,16 +654,16 @@ typeof question.answer; // 'bigint'
654654
### Double {#double}
655655

656656
Mongoose supports [64-bit IEEE 754-2008 floating point numbers](https://en.wikipedia.org/wiki/IEEE_754-2008_revision) as a SchemaType.
657-
Int32s are stored as [BSON type "double" in MongoDB](https://www.mongodb.com/docs/manual/reference/bson-types/).
657+
Doubles are stored as [BSON type "double" in MongoDB](https://www.mongodb.com/docs/manual/reference/bson-types/).
658658

659659
```javascript
660-
const studentsSchema = new Schema({
661-
id: Int32
660+
const temperatureSchema = new Schema({
661+
celsius: Double
662662
});
663-
const Student = mongoose.model('Student', schema);
663+
const Temperature = mongoose.model('Temperature', temperatureSchema);
664664

665-
const student = new Temperature({ celsius: 1339 });
666-
typeof student.id; // 'number'
665+
const temperature = new Temperature({ celsius: 1339 });
666+
temperature.celsius instanceof bson.Double; // true
667667
```
668668

669669
There are several types of values that will be successfully cast to a Double.
@@ -673,7 +673,7 @@ new Temperature({ celsius: '1.2e12' }).celsius; // 15 as a Double
673673
new Temperature({ celsius: true }).celsius; // 1 as a Double
674674
new Temperature({ celsius: false }).celsius; // 0 as a Double
675675
new Temperature({ celsius: { valueOf: () => 83.0033 } }).celsius; // 83 as a Double
676-
new Temperature({ celsius: '' }).celsius; // null as a Double
676+
new Temperature({ celsius: '' }).celsius; // null
677677
```
678678

679679
The following inputs will result will all result in a [CastError](validation.html#cast-errors) once validated, meaning that it will not throw on initialization, only when validated:
@@ -688,12 +688,12 @@ Mongoose supports 32-bit integers as a SchemaType.
688688
Int32s are stored as [32-bit integers in MongoDB (BSON type "int")](https://www.mongodb.com/docs/manual/reference/bson-types/).
689689

690690
```javascript
691-
const studentsSchema = new Schema({
691+
const studentSchema = new Schema({
692692
id: Int32
693693
});
694-
const Student = mongoose.model('Student', schema);
694+
const Student = mongoose.model('Student', studentSchema);
695695

696-
const student = new Temperature({ celsius: 1339 });
696+
const student = new Student({ id: 1339 });
697697
typeof student.id; // 'number'
698698
```
699699

0 commit comments

Comments
 (0)