Skip to content

Commit

Permalink
Merge branch '6.5' into vkarpov15/gh-11541
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jul 18, 2022
2 parents 3a1c821 + 7187253 commit 8f4cc45
Show file tree
Hide file tree
Showing 220 changed files with 2,599 additions and 1,566 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@
"mocha-no-only/mocha-no-only": [
"error"
],
"no-empty": "off"
"no-empty": "off",
"eol-last": "warn",
"no-multiple-empty-lines": ["warn", { "max": 2 }]
}
}
}
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# These are supported funding model platforms

github: vkarpov15
github: mongoosejs
open_collective: mongoose
tidelift: npm/mongoose
24 changes: 11 additions & 13 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ name: Benchmark
on:
pull_request:
paths:
- '.github/workflows/benchmark.yml'
- 'package.json'
- 'types/**'
- 'benchmarks/typescript/**'
- 'benchmarks/typescript.js'
- ".github/workflows/benchmark.yml"
- "package.json"
- "types/**"
- "benchmarks/typescript/**"
push:
branches:
- master
paths:
- '.github/workflows/benchmark.yml'
- 'package.json'
- 'types/**'
- 'benchmarks/typescript/**'
- 'benchmarks/typescript.js'
- ".github/workflows/benchmark.yml"
- "package.json"
- "types/**"
- "benchmarks/typescript/**"
permissions:
contents: read

Expand All @@ -27,12 +25,12 @@ jobs:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

- name: Setup node
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.1.1
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1
with:
node-version: 16

- run: npm install

- run: node ./benchmarks/typescript
- run: npx ts-benchmark -p ./benchmarks/typescript/simple -f 17/100000 18 29 32 -b master -g --colors
env:
DB_URL: ${{ secrets.DB_URL }}
DB_URL: ${{ secrets.DB_URL }}
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3

- name: Setup node
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.1.0
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1
with:
node-version: 16

Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

- name: Setup node
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.1.1
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1
with:
node-version: 14

Expand All @@ -37,8 +37,6 @@ jobs:
run: npm run lint-js

test:
needs:
- lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -60,7 +58,7 @@ jobs:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

- name: Setup node
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.1.1
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1
with:
node-version: ${{ matrix.node }}

Expand All @@ -86,7 +84,7 @@ jobs:
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Setup node
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.1.1
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1
with:
node-version: 16
- run: npm install
Expand All @@ -101,7 +99,7 @@ jobs:
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Setup node
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.1.1
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1
with:
node-version: 16
- run: npm install
Expand Down Expand Up @@ -132,4 +130,4 @@ jobs:
- name: Check out repo
uses: actions/checkout@v3
- name: Dependency review
uses: actions/dependency-review-action@v1
uses: actions/dependency-review-action@v2
2 changes: 1 addition & 1 deletion .github/workflows/tidelift-alignment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Setup node
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.1.1
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1
with:
node-version: 16
- name: Alignment
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

- name: Setup node
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.1.1
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1
with:
node-version: 14

Expand All @@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

- name: Setup node
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.1.1
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1
with:
node-version: 12

Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,9 @@ docs/*.html
docs/tutorials/*.html
docs/typescript/*.html
docs/api/*.html
index.html
index.html

# yarn package-lock
yarn.lock

examples/ecommerce-netlify-functions/.netlify/state.json
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
6.4.4 / 2022-07-08
==================
* fix(types): allow using an object to configure timestamps #12061 [lantw44](https://github.com/lantw44)
* fix(types): support findOneAndReplace with rawResult #12062 [lantw44](https://github.com/lantw44)
* docs: upgrade API documentation parser #12078 #12072 #12071 #12024 [hasezoey](https://github.com/hasezoey)
* docs(document): add more info on $isNew #11990
* docs: add SchemaType doValidate() to docs #12068

6.4.3 / 2022-07-05
==================
* fix(document): handle validating deeply nested subdocuments underneath nested paths with required: false #12021
* fix(types): infer schematype type from schema paths when calling `SchemaType.path()` #11987
* fix(types): add $top and $topN aggregation operators #12053
* fix(types): clean up a couple of issues with $add and $ifNull #12017
* fix(types): allow $cond with $in #12028
* docs: add path level descending index example in docs #12023 [MitchellCash](https://github.com/MitchellCash)
* docs: add Buffer, Decimal128, Map to docs #11971

6.4.2 / 2022-07-01
==================
* fix: keep autoIndex & autoCreate as true by default if read preference is primaryPreferred #11976
* fix(types): improve inferred Schema Type to handle nested paths and ObjectIds #12007 [iammola](https://github.com/iammola)
* fix(types): avoid inferring doc type from param to create() #12001
* fix(types): make populate Paths generic consistently overwrite doc interface #11955
* fix(types): allow null at ne expression second parameter #11996 [jyeros](https://github.com/jyeros)
* fix(types): change index "weights" to be more explicit #11997 [hasezoey](https://github.com/hasezoey)

6.4.1 / 2022-06-27
==================
* fix(schema): allow 0 for numbers if required and ref both set #11912
* fix(query): skip applying default projections over slice projections #11940
* fix(types): handle arrays in ApplyBasicQueryCasting correctly #11964
* fix(types): fix $match typings #11969 [andreialecu](https://github.com/andreialecu)
* fix(types): avoid adding non-existent properties from model constructor for typegoose #11960
* fix(types): make Mongoose UpdateQuery compatible with MongoDB `UpdateFilter` #11911
* fix(types): simplify MergeType constraints #11978
* fix(types): correct references to Buffer for @types/node >= 16.0.0 < 16.6.0 #11963
* fix(types): re-add the possibility to pass undefined for projection in Model.find #11965 [ghost91-](https://github.com/ghost91-)
* fix(types): fix typo for indexes #11953 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
* fix(document+types): document merge option #11913
* docs: update schematypes.md #11981 [korzio](https://github.com/korzio)
* docs: update validation.md #11982 [korzio](https://github.com/korzio)

6.4.0 / 2022-06-17
==================
* feat: upgrade mongodb driver -> 4.7.0 #11909 [AbdelrahmanHafez](https://github.com/AbdelrahmanHafez)
Expand Down
97 changes: 53 additions & 44 deletions benchmarks/benchjs/casting.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ const utils = require('../../lib/utils.js');
* These are all the benchmark tests for casting stuff
*/


const Comments = new Schema();

Comments.add({
title: String,
date: Date,
body: String,
comments: [Comments]
comments: [Comments],
});

const BlogPost = new Schema({
Expand All @@ -35,7 +34,7 @@ const BlogPost = new Schema({
date: Date,
meta: {
date: Date,
visitors: Number
visitors: Number,
},
published: Boolean,
mixed: {},
Expand All @@ -45,14 +44,15 @@ const BlogPost = new Schema({
comments: [Comments],
def: {
type: String,
default: 'kandinsky'
}
default: 'kandinsky',
},
});

const commentData = {
title: 'test comment',
date: new Date(),
body: 'this be some crazzzyyyyy text that would go in a comment',
comments: [{ title: 'second level', date: new Date(), body: 'texttt' }]
comments: [{ title: 'second level', date: new Date(), body: 'texttt' }],
};

const blogData = {
Expand All @@ -62,22 +62,23 @@ const blogData = {
date: new Date(),
meta: {
date: new Date(),
visitors: 9001
visitors: 9001,
},
published: true,
mixed: {
thisIsRandom: true
thisIsRandom: true,
},
numbers: [1, 2, 7, 10, 23432],
tags: ['test', 'BENCH', 'things', 'more things'],
def: 'THANGS!!!',
comments: []
comments: [],
};

const blogData10 = utils.clone(blogData);
const blogData100 = utils.clone(blogData);
const blogData1000 = utils.clone(blogData);
const blogData10000 = utils.clone(blogData);

for (let i = 0; i < 10; i++) {
blogData10.comments.push(commentData);
}
Expand All @@ -90,47 +91,54 @@ for (let i = 0; i < 1000; i++) {
for (let i = 0; i < 10000; i++) {
blogData10000.comments.push(commentData);
}

mongoose.model('BlogPost', BlogPost);

suite.add('Casting - Embedded Docs - 0 Docs', {
fn: function() {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData);
}
}).add('Casting - Embedded Docs - 10 Docs', {
fn: function() {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData10);
}
}).add('Casting - Embedded Docs - 100 Docs', {
fn: function() {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData100);
}
}).add('Casting - Embedded Docs - 1000 Docs', {
fn: function() {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData1000);
}
}).add('Casting - Embedded Docs - 10000 Docs', {
fn: function() {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData10000);
}
})
.on('cycle', function(evt) {
suite
.add('Casting - Embedded Docs - 0 Docs', {
fn: function () {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData);
},
})
.add('Casting - Embedded Docs - 10 Docs', {
fn: function () {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData10);
},
})
.add('Casting - Embedded Docs - 100 Docs', {
fn: function () {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData100);
},
})
.add('Casting - Embedded Docs - 1000 Docs', {
fn: function () {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData1000);
},
})
.add('Casting - Embedded Docs - 10000 Docs', {
fn: function () {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData10000);
},
})
.on('cycle', function (evt) {
if (process.env.MONGOOSE_DEV || process.env.PULL_REQUEST) {
console.log(String(evt.target));
}
}).on('complete', function() {
})
.on('complete', function () {
if (!process.env.MONGOOSE_DEV && !process.env.PULL_REQUEST) {
const outObj = {};
this.forEach(function(item) {
this.forEach(function (item) {
const out = {};
out.stats = item.stats;
delete out.stats.sample;
Expand All @@ -139,4 +147,5 @@ suite.add('Casting - Embedded Docs - 0 Docs', {
});
console.dir(outObj, { depth: null, colors: true });
}
}).run({ async: true });
})
.run({ async: true });

0 comments on commit 8f4cc45

Please sign in to comment.