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

Bump mongoose from 5.13.20 to 8.8.3 #1301

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
docdb:
# use a mongo image that most closely matches the DocumentDB API
Expand Down
9,981 changes: 4,746 additions & 5,235 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
"standard": "^16.0.3"
},
"dependencies": {
"bson": "^6.10.1",
"ajv": "^8.6.2",
"ajv-formats": "^2.1.1",
"argon2": "^0.29",
"argon2": "^0.41.1",
"config": "^3.3.6",
"cors": "^2.8.5",
"crypto-random-string": "^3.3.1",
Expand All @@ -45,7 +46,7 @@
"lodash": "^4.17.21",
"luxon": "^3.4.4",
"mongo-cursor-pagination": "^8.1.3",
"mongoose": "^5.13.20",
"mongoose": "^8.8.3",
"mongoose-aggregate-paginate-v2": "1.0.6",
"morgan": "^1.9.1",
"node-dev": "^7.4.3",
Expand All @@ -59,6 +60,7 @@
"winston": "^3.2.1",
"yamljs": "^0.3.0"
},
"overrides": { "mongo-cursor-pagination": { "bson": "^6.10.1" } },
"apidoc": {
"name": "CVE-Services",
"version": "0.0.0",
Expand Down
4 changes: 1 addition & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ app.use((req, res, next) => {
const dbConnectionStr = dbUtils.getMongoConnectionString()
mongoose.connect(dbConnectionStr, {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true
useUnifiedTopology: true
})

// database connection
Expand Down
3 changes: 1 addition & 2 deletions src/scripts/populate-cve.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ global.mongoose = mongoose
const dbConnectionStr = dbUtils.getMongoConnectionString()
mongoose.connect(dbConnectionStr, {
useNewUrlParser: true,
useUnifiedTopology: false,
useFindAndModify: false
useUnifiedTopology: false
})

// database connection
Expand Down
1 change: 0 additions & 1 deletion src/scripts/populate.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const dbConnectionStr = dbUtils.getMongoConnectionString()
mongoose.connect(dbConnectionStr, {
useNewUrlParser: true,
useUnifiedTopology: false,
useFindAndModify: false,
autoIndex: false
})

Expand Down
3 changes: 1 addition & 2 deletions src/scripts/templateScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ const error = new errors.IDRError()
const dbConnectionStr = dbUtils.getMongoConnectionString()
mongoose.connect(dbConnectionStr, {
useNewUrlParser: true,
useUnifiedTopology: false,
useFindAndModify: false
useUnifiedTopology: false
})

const db = mongoose.connection
Expand Down
1 change: 0 additions & 1 deletion test-http/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
demon:
container_name: demon
Expand Down
2 changes: 1 addition & 1 deletion test/integration-tests/cve/cursorPaginationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe('Testing Get cve_cursor endpoint', () => {
// Request page 2
await requester.get('/api/cve_cursor?limit=2&next_page=' + next + '&time_modified.lt=' + currentDate)
.set(constants.headers)
.then((res, err) => {
.then(async (res, err) => {
expect(err).to.be.undefined
expect(res).to.have.status(200)

Expand Down
4 changes: 2 additions & 2 deletions test/integration-tests/org/postOrgUsersTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ describe('Testing user post endpoint', () => {
expect(err).to.be.undefined
})
})
it('Fails creation of user for trying to add the 101th user', async () => {
it('Fails creation of user for trying to add the 101th user', async function () {
this.timeout(7000)
const numberOfUsers = await User.where({ org_UUID: orgUuid }).countDocuments().exec()
for (let i = 0; i < (100 - numberOfUsers); i++) {
const newUser = new User()
Expand All @@ -156,7 +157,6 @@ describe('Testing user post endpoint', () => {
'ADMIN'
]
}

await User.findOneAndUpdate().byUserNameAndOrgUUID(newUser.userName, newUser.org_UUID).updateOne(newUser).setOptions({ upsert: true })
}

Expand Down
31 changes: 18 additions & 13 deletions test/unit-tests/org/orgGetIdQuotaTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,29 @@ describe('Testing the GET /org/:shortname/id_quota endpoint in Org Controller',
context('Negative Tests', () => {
it('Org with a negative id_quota was not saved', (done) => {
const org = new Org(orgFixtures.orgWithNegativeIdQuota)

org.validate((err) => {
const CONSTANTS = getConstants()

expect(err.errors['policies.id_quota'].message).to.equal(CONSTANTS.MONGOOSE_VALIDATION.Org_policies_id_quota_min_message)
done()
})
org.save()
.then(() => {
expect(false)
})
.catch((error) => {
const CONSTANTS = getConstants()
expect(error.errors['policies.id_quota'].message).to.equal(CONSTANTS.MONGOOSE_VALIDATION.Org_policies_id_quota_min_message)
})
done()
})

it('Org with an id_quota greater than the max was not saved', (done) => {
const org = new Org(orgFixtures.orgExceedingMaxIdQuota)

org.validate((err) => {
const CONSTANTS = getConstants()

expect(err.errors['policies.id_quota'].message).to.equal(CONSTANTS.MONGOOSE_VALIDATION.Org_policies_id_quota_max_message)
done()
})
org.save()
.then(() => {
expect(false)
})
.catch((error) => {
const CONSTANTS = getConstants()
expect(error.errors['policies.id_quota'].message).to.equal(CONSTANTS.MONGOOSE_VALIDATION.Org_policies_id_quota_max_message)
})
done()
})

it('Requestor is not secretariat or a user of the same org', (done) => {
Expand Down
Loading