Skip to content

Commit a70feb0

Browse files
Merge pull request #1 from mongoosejs/vkarpov15/mongoose-9-test
test against Mongoose 9
2 parents 29c98d3 + 18a6bbd commit a70feb0

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on:
44
push:
55
jobs:
66
test:
7-
runs-on: ubuntu-20.04
7+
runs-on: ubuntu-22.04
88
strategy:
99
fail-fast: false
1010
matrix:
11-
node: [16, 18, 20]
11+
node: [22, 24]
1212
name: Node ${{ matrix.node }}
1313
steps:
1414
- uses: actions/checkout@v2
@@ -22,14 +22,13 @@ jobs:
2222

2323
- name: Setup
2424
run: |
25-
wget -q http://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-5.0.8.tgz
26-
tar xf mongodb-linux-x86_64-ubuntu2004-5.0.8.tgz
25+
wget -q http://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-8.0.7.tgz
26+
tar xf mongodb-linux-x86_64-ubuntu2204-8.0.7.tgz
2727
mkdir -p ./data/db/27017 ./data/db/27000
2828
printf "\n--timeout 8000" >> ./test/mocha.opts
29-
./mongodb-linux-x86_64-ubuntu2004-5.0.8/bin/mongod --fork --dbpath ./data/db/27017 --syslog --port 27017
29+
./mongodb-linux-x86_64-ubuntu2204-8.0.7/bin/mongod --fork --dbpath ./data/db/27017 --syslog --port 27017
3030
sleep 2
31-
mongod --version
32-
echo `pwd`/mongodb-linux-x86_64-ubuntu2004-5.0.8/bin >> $GITHUB_PATH
31+
echo `pwd`/mongodb-linux-x86_64-ubuntu2204-8.0.7/bin >> $GITHUB_PATH
3332
3433
- run: npm test
3534

@@ -42,7 +41,7 @@ jobs:
4241
- name: Setup node
4342
uses: actions/setup-node@v1
4443
with:
45-
node-version: 14
44+
node-version: 22
4645

4746
- run: npm install
4847

index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ function handleFunction(fn, options) {
229229
}
230230

231231
function eachPathRecursive(schema, handler, path, schemaStack) {
232-
233232
if (schemaStack.has(schema)) {
234233
return;
235234
}
@@ -253,9 +252,9 @@ function eachPathRecursive(schema, handler, path, schemaStack) {
253252
);
254253
}
255254
}
256-
} else if (schemaType.$isMongooseArray && schemaType.$embeddedSchemaType.$isMongooseArray) {
255+
} else if (schemaType.$isMongooseArray && getEmbeddedSchemaType(schemaType).$isMongooseArray) {
257256
while (schemaType != null && schemaType.$isMongooseArray && !schemaType.$isMongooseDocumentArray) {
258-
schemaType = schemaType.$embeddedSchemaType;
257+
schemaType = getEmbeddedSchemaType(schemaType);
259258
}
260259
if (schemaType != null && schemaType.$isMongooseDocumentArray) {
261260
eachPathRecursive(schemaType.schema, handler, path, schemaStack);
@@ -285,3 +284,7 @@ function eachPathRecursive(schema, handler, path, schemaStack) {
285284
});
286285
}
287286
}
287+
288+
function getEmbeddedSchemaType(schemaType) {
289+
return schemaType.embeddedSchemaType ?? schemaType.$embeddedSchemaType;
290+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"acquit-markdown": "0.1.0",
2828
"eslint": "7.32.0",
2929
"mocha": "5.1.1",
30-
"mongoose": "8.x",
30+
"mongoose": "9.0.0-rc1",
3131
"nyc": "11.7.3"
3232
},
3333
"peerDependencies": {

0 commit comments

Comments
 (0)