Skip to content

Commit a63f599

Browse files
Merge branch 'Automattic:master' into master
2 parents e136c94 + b33c55d commit a63f599

File tree

253 files changed

+7291
-7159
lines changed

Some content is hidden

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

253 files changed

+7291
-7159
lines changed

.eslintrc.js

Lines changed: 0 additions & 204 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ jobs:
2424
- name: Install dependencies
2525
run: npm install
2626

27-
- name: browser build
28-
run: npm run build-browser
29-
3027
- name: Dry run publish with provenance
3128
run: npm publish --provenance --access public
3229
env:

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
strategy:
4040
fail-fast: false
4141
matrix:
42-
node: [16, 18, 20, 22, 24]
42+
node: [18, 20, 22, 24]
4343
os: [ubuntu-22.04, ubuntu-24.04]
4444
mongodb: [6.0.15, 7.0.12, 8.2.0]
4545
include:

CHANGELOG.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,69 @@
1+
9.0.0 / 2025-11-21
2+
==================
3+
* BREAKING CHANGE: drop support for callback-based pre middleware, e.g. `next()` in `pre()` hooks
4+
* BREAKING CHANGE: update to MongoDB Node driver v7
5+
* BREAKING CHANGE: make UUID schema type return bson UUIDs #15378
6+
* BREAKING CHANGE: make findOne(null), find(null), etc. throw an error instead of returning first doc #15019 #14948
7+
* BREAKING CHANGE: disallow update pipelines by default, require updatePipeline option #15586 #14424
8+
* BREAKING CHANGE: call virtual ref function with subdoc, not top-level doc #14652 #12440 #12363
9+
* BREAKING CHANGE(types): make create() and insertOne() params more strict, remove generics to prevent type inference #15587 #15355
10+
* BREAKING CHANGE(types): make FilterQuery properties no longer resolve to any in TypeScript #15422
11+
* BREAKING CHANGE(types): change `this` to HydratedDocument for default() and required(), HydratedDocument | Query for validate() #15020 #14696
12+
* BREAKING CHANGE(types): make id a virtual in TypeScript rather than a property on Document base class #15572 #13079
13+
* BREAKING CHANGE(types): consolidate RootQuerySelector, Condition, etc. types with MongoDB driver's #15593
14+
* BREAKING CHANGE: asyncify update validators, SchemaType.prototype.doValidate(), save hooks for improved stack traces #15312
15+
* BREAKING CHANGE: remove bson as direct dependency, use mongodb/lib/bson instead #15576 #15154
16+
* BREAKING CHANGE: remove _executionStack, make validate() async function and call Kareem hooks directly vs through wrappers #15298 #14906
17+
* BREAKING CHANGE: remove browser build, move to @mongoosejs/browser instead #15385 #15296
18+
* BREAKING CHANGE: remove schematype caster and casterConstructor properties in favor of embeddedSchemaType and Constructor #15513 #15179
19+
* BREAKING CHANGE: adding missing pluralizations, fixing pluralization: virus -> viruses #14247 [ItsBradyDavis](https://github.com/ItsBradyDavis)
20+
* BREAKING CHANGE: remove connection noListener option #15641 #15640
21+
* feat(types): add Schema.create() for TypeScript type inference #15482 #14954
22+
* chore: remove examples directory #15597
23+
24+
8.20.1 / 2025-11-20
25+
===================
26+
* types: correct Model.schema type and fix unknown check for this param type in schema.methods #15750 #15693
27+
* docs: add detailed loadClass() TypeScript usage guide #15731 #12813 [Necro-Rohan](https://github.com/Necro-Rohan)
28+
* docs: update version support documentation for Mongoose #15761 [ManmathX](https://github.com/ManmathX)
29+
* docs: add copy-to-clipboard feature for code blocks in docs #15759 [vedansha07](https://github.com/vedansha07)
30+
31+
9.0.0-rc1 / 2025-11-19
32+
======================
33+
* fix(populate): correctly populate embedded discriminators on subdocuments #15774
34+
35+
9.0.0-rc0 / 2025-11-19
36+
======================
37+
* BREAKING CHANGE: drop support for callback-based pre middleware, e.g. `next()` in `pre()` hooks
38+
* BREAKING CHANGE: update to MongoDB Node driver v7
39+
* BREAKING CHANGE: make UUID schema type return bson UUIDs #15378
40+
* BREAKING CHANGE: make findOne(null), find(null), etc. throw an error instead of returning first doc #15019 #14948
41+
* BREAKING CHANGE: disallow update pipelines by default, require updatePipeline option #15586 #14424
42+
* BREAKING CHANGE: call virtual ref function with subdoc, not top-level doc #14652 #12440 #12363
43+
* BREAKING CHANGE(types): make create() and insertOne() params more strict, remove generics to prevent type inference #15587 #15355
44+
* BREAKING CHANGE(types): make FilterQuery properties no longer resolve to any in TypeScript #15422
45+
* BREAKING CHANGE(types): change `this` to HydratedDocument for default() and required(), HydratedDocument | Query for validate() #15020 #14696
46+
* BREAKING CHANGE(types): make id a virtual in TypeScript rather than a property on Document base class #15572 #13079
47+
* BREAKING CHANGE(types): consolidate RootQuerySelector, Condition, etc. types with MongoDB driver's #15593
48+
* BREAKING CHANGE: asyncify update validators, SchemaType.prototype.doValidate(), save hooks for improved stack traces #15312
49+
* BREAKING CHANGE: remove bson as direct dependency, use mongodb/lib/bson instead #15576 #15154
50+
* BREAKING CHANGE: remove _executionStack, make validate() async function and call Kareem hooks directly vs through wrappers #15298 #14906
51+
* BREAKING CHANGE: remove browser build, move to @mongoosejs/browser instead #15385 #15296
52+
* BREAKING CHANGE: remove schematype caster and casterConstructor properties in favor of embeddedSchemaType and Constructor #15513 #15179
53+
* BREAKING CHANGE: adding missing pluralizations, fixing pluralization: virus -> viruses #14247 [ItsBradyDavis](https://github.com/ItsBradyDavis)
54+
* BREAKING CHANGE: remove connection noListener option #15641 #15640
55+
* feat(types): add Schema.create() for TypeScript type inference #15482 #14954
56+
* chore: remove examples directory #15597
57+
58+
8.20.0 / 2025-11-17
59+
===================
60+
* feat: cast id parameter based on schema _id type in DocumentArray.id() #15733 #15725 #15724 [Lex-Ashu](Lex-Ashu)
61+
* fix: pass parent schema to SchemaType constructors in interpretAsType to make implementing custom container types easier #15700
62+
* types(models): default _id type to ObjectId for Document #15688 [Catwallon](https://github.com/Catwallon)
63+
* docs: add FAQ entry about DivergentArrayError #15743 [Mario5T](https://github.com/Mario5T)
64+
* docs: update browser.md with Mongoose limitations #15744 [YashSharma64](https://github.com/YashSharma64)
65+
* chore: add benchmark for large nested array documents (related to #9588) #15742 [Kundan-CR7](https://github.com/Kundan-CR7)
66+
167
8.19.4 / 2025-11-14
268
===================
369
* fix(schema): avoid throwing error on array of unions #15720 #15718

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Mongoose is a [MongoDB](https://www.mongodb.org/) object modeling tool designed
1313

1414
The official documentation website is [mongoosejs.com](http://mongoosejs.com/).
1515

16-
Mongoose 8.0.0 was released on October 31, 2023. You can find more details on [backwards breaking changes in 8.0.0 on our docs site](https://mongoosejs.com/docs/migrating_to_8.html).
16+
Mongoose 9.0.0 was released on November 21, 2025. You can find more details on [backwards breaking changes in 9.0.0 on our docs site](https://mongoosejs.com/docs/migrating_to_9.html).
1717

1818
## Support
1919

benchmarks/nestedArrayLarge.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
'use strict';
2+
3+
const mongoose = require('../');
4+
5+
run().catch(err => {
6+
console.error(err);
7+
process.exit(-1);
8+
});
9+
10+
async function run() {
11+
await mongoose.connect('mongodb://127.0.0.1:27017/mongoose_benchmark');
12+
13+
const bookSchema = new mongoose.Schema({
14+
ticker: String,
15+
asks: [[Number]],
16+
bids: [[Number]],
17+
timestamp: String,
18+
});
19+
20+
const Book = mongoose.model('BookNestedArray', bookSchema);
21+
22+
const doc = { asks: [], bids: [] };
23+
for (let i = 0; i < 10000; ++i) {
24+
doc.asks.push([i]);
25+
doc.bids.push([i]);
26+
}
27+
28+
if (!process.env.MONGOOSE_BENCHMARK_SKIP_SETUP) {
29+
await Book.deleteMany({});
30+
}
31+
32+
const constructStart = Date.now();
33+
for (let i = 0; i < 100; ++i) {
34+
new Book(doc);
35+
}
36+
const constructEnd = Date.now();
37+
38+
const inst = new Book(doc);
39+
const saveStart = Date.now();
40+
await inst.save();
41+
const saveEnd = Date.now();
42+
43+
const results = {
44+
'document construction (100x) ms': +(constructEnd - constructStart).toFixed(2),
45+
'save() time ms': +(saveEnd - saveStart).toFixed(2)
46+
};
47+
48+
console.log(JSON.stringify(results, null, ' '));
49+
process.exit(0);
50+
}

browser.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)