Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added support for mongoose v8 #1083

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 67 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@
"mongodb": "^6.1.0",
"mongodb-v4": "npm:mongodb@^4.16.0",
"mongodb-v5": "npm:mongodb@^5.4.0",
"mongoose": "^7.1.0",
"mongoose-v5": "npm:mongoose@^5.13.17",
"mongoose-v6": "npm:mongoose@^6.11.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mongoose is still publishing releases for the old major versions e.g. see https://github.com/Automattic/mongoose/tree/5.13.22

"mongoose": "^8.2.2",
"mongoose-v5": "npm:mongoose@^5.13.22",
"mongoose-v6": "npm:mongoose@^6.12.7",
"mongoose-v7": "npm:mongoose@^7.6.10",
"morgan": "^1.10.0",
"mssql": "^10.0.1",
"mssql-v9": "npm:mssql@^9.0.1",
Expand Down
4 changes: 1 addition & 3 deletions packages/collector/test/tracing/database/mongoose/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
'use strict';

require('./mockVersion');
const isLatest = process.env.MONGOOSE_VERSION === 'latest';

require('../../../..')();

const bodyParser = require('body-parser');
Expand Down Expand Up @@ -47,7 +45,7 @@ mongoose.model(
);
const Person = mongoose.model('Person');

if (isLatest) {
if (process.env.MONGOOSE_VERSION === 'latest' || process.env.MONGOOSE_VERSION === 'v7') {
(async () => {
try {
await mongoose.connect(connectString);
Expand Down
4 changes: 1 addition & 3 deletions packages/collector/test/tracing/database/mongoose/app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

'use strict';

const isLatest = process.env.MONGOOSE_VERSION === 'latest';

import bodyParser from 'body-parser';
import mongoose from 'mongoose';
import express from 'express';
Expand Down Expand Up @@ -45,7 +43,7 @@ mongoose.model(
);
const Person = mongoose.model('Person');

if (isLatest) {
if (process.env.MONGOOSE_VERSION === 'latest' || process.env.MONGOOSE_VERSION === 'v7') {
(async () => {
try {
await mongoose.connect(connectString);
Expand Down
7 changes: 5 additions & 2 deletions packages/collector/test/tracing/database/mongoose/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ const USE_ATLAS = process.env.USE_ATLAS === 'true';

// v5 uses mongodb v3
// v6 uses mongodb v4
// latest (v7) uses mongodb v5
// v7 uses mongodb v5
// v8 uses mongodb v6

['latest', 'v6', 'v5'].forEach(version => {
['latest', 'v7', 'v6', 'v5'].forEach(version => {
let mochaSuiteFn = supportedVersion(process.versions.node) ? describe : describe.skip;

if (version === 'latest') {
mochaSuiteFn = semver.lt(process.versions.node, '16.0.0') ? describe.skip : mochaSuiteFn;
} else if (version === 'v7') {
mochaSuiteFn = semver.lt(process.versions.node, '14.0.0') ? describe.skip : mochaSuiteFn;
} else if (version === 'v6') {
mochaSuiteFn = semver.lt(process.versions.node, '12.0.0') ? describe.skip : mochaSuiteFn;
Expand Down