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(deps): update mongoose to 6 #6832

Merged
merged 66 commits into from
Jan 8, 2024
Merged

feat(deps): update mongoose to 6 #6832

merged 66 commits into from
Jan 8, 2024

Conversation

KenLSM
Copy link
Contributor

@KenLSM KenLSM commented Oct 23, 2023

Problem

| MongoDB 4.4 End of Life on February 29, 2024; automatic Atlas cluster upgrades to 5.0

Closes FRM-1294, Closes FRM-1471, Closes #6424

Solution

  • update deps "mongoose": "^6.12.0",
  • removed devDeps "@types/mongodb": "^3.6.20",
  • replaced deps bson-ext with bson. We can choose to migrate off bson and replace it with either mongoose.Types.ObjectId / mongoose.Scheme.Types.ObjectId accordingly.
  • update deps "mongodb-memory-server-core": "^7.6.3",

Breaking Changes

  • No - this PR is backwards compatible. ⚠️ However, the subsequent phases that upgrades mongodb will not be backwards compatible.

Tests

Full regression test

Deploy Notes

Reminder for engs to rebuild your docker images on local with these flags --build --rebuild-anon-volumes as there are several package changes.

@KenLSM KenLSM force-pushed the chore/mongoose-bump-6 branch from a3a4c4f to 0f9be39 Compare October 23, 2023 08:59
@KenLSM KenLSM changed the title Chore/mongoose bump 6 chore(deps): update mongoose to 6 Oct 23, 2023
@linear
Copy link

linear bot commented Oct 23, 2023

FRM-1294 Evaluate MongoDB Version Upgrade

https://www.notion.so/Upgrade-to-Mongoose-6-12-0-MongoServer-5-x-Bumping-up-from-4-4-62866cd1d75542018e6485eb5ed9b802

Also relevant: MongoDB email

MongoDB 4.4 End of Life on February 29, 2024; automatic Atlas cluster upgrades to 5.0

@KenLSM KenLSM force-pushed the chore/mongoose-bump-6 branch from 9ba398f to 5b59002 Compare October 24, 2023 09:57
@KenLSM KenLSM temporarily deployed to staging-alt October 24, 2023 13:36 — with GitHub Actions Inactive
@KenLSM KenLSM marked this pull request as ready for review October 24, 2023 14:30
@linear
Copy link

linear bot commented Oct 25, 2023

@KenLSM KenLSM temporarily deployed to staging-alt October 25, 2023 05:22 — with GitHub Actions Inactive
@KenLSM KenLSM temporarily deployed to staging-alt October 25, 2023 06:23 — with GitHub Actions Inactive
@foochifa
Copy link
Contributor

Relevant PRs from days passed that @KenLSM found
#3093
#3541

@KenLSM KenLSM force-pushed the chore/mongoose-bump-6 branch 4 times, most recently from 1bab4cf to 4c6f389 Compare October 31, 2023 07:07
@KenLSM KenLSM force-pushed the chore/mongoose-bump-6 branch from 4c417f7 to e5db025 Compare November 7, 2023 06:16
@KenLSM KenLSM changed the title chore(deps): update mongoose to 6 feat(deps): update mongoose to 6 Jan 2, 2024
KenLSM added 4 commits January 2, 2024 17:07
# Conflicts:
#	src/app/models/__tests__/encrypt-submission.server.model.spec.ts
#	src/app/models/form.server.model.ts
#	src/app/models/submission.server.model.ts
#	src/app/modules/submission/__tests__/submission.controller.spec.ts
#	src/app/modules/submission/encrypt-submission/__tests__/encrypt-submission.service.spec.ts
#	src/app/modules/submission/encrypt-submission/__tests__/encrypt-submission.utils.spec.ts
#	src/types/submission.ts
@KenLSM KenLSM requested review from justynoh, wanlingt and tshuli January 3, 2024 11:11
useNewUrlParser: true,
})
export const makeMongooseFixtures = (): Promise<mongoose.Connection> => {
const dbUri = 'mongodb://127.0.0.1:3000/test' // TODO: hardcoding uri as the port and path are fixed and doesn't respect values in __tests__/e2e/setup/setupConfig.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const dbUri = 'mongodb://127.0.0.1:3000/test' // TODO: hardcoding uri as the port and path are fixed and doesn't respect values in __tests__/e2e/setup/setupConfig.ts
const dbUri = 'mongodb://127.0.0.1:3000/test'

@KenLSM KenLSM merged commit b87db61 into develop Jan 8, 2024
22 of 24 checks passed
@KenLSM KenLSM deleted the chore/mongoose-bump-6 branch January 8, 2024 09:17
tshuli pushed a commit that referenced this pull request Jan 8, 2024
* chore: bump mongoose to 6.12

* fix: type mismatch on cursorquery, objectid

* fix: required and validator shape in user and form model

* fix: use try catch block for mongoose connect loader

* fix: add missing goLinkSuffix property in IForm

* fix: overwrite typing of IPaymentSchema for mongoose Id

* fix: querycursor import in submission.ts

* fix: removed undefined in AgencySchema causing schema methods to be never

* fix: schema typings in form logic and sms types

* fix: replace ConnectionOptions with ConnectOptions

* fix: remove deprecated connect options

* fix: objectid imports

* chore: remove mongodb package, upgrade connect-mongo to 4.6.0

* chore: replace mongoerror import reference

* fix: typescript errors

* chore: change nModified to modifiedCount

* fix: typeerror on form_statistics_total.server.model

* fix: typeerror on bouncemodel

* fix: form server model, only fixed affected methods

* fix: mongoerror is now mongoservererror

* fix: execPopulate no longer required to be called

* fix: verification.model

* fix: replace enforcedocument to hydrateddocument

* fix: duplicateFormFieldByIdAndIndex

* fix: util/logic.ts type inference errors

* refactor: swap bson with bson-ext

* chore: update test db configs

* refactor: remove bson reference

* refactor: gloal replacement of bson

* chore: remove execPopulate

* fix: void promise returns

* fix: remove bson reference with mongoose

* fix: replace more bson on admin-forms.form.routes.specs

* fix: test failures on admin-forms.submissions.routes.spec

* fix: test failures on src/app/models

* fix: test failures on src/app/modules/payments

* fix: test failures on src/app/modules/issues

* fix: form model always defaulting to private mode on save

* chore: remove bson in jest-db

* fix: lint and type errors in loader

* chore: remove unused typedef

* chore: remove commented out BSON code

* fix: playwright mongod init failure

* refactor: rename constants

* fix: mongoose loader

* fix: removed form model business field to be required

* fix: e2e email-submission tests

* fix: make mongoose.connect to be async

* fix: add specific db connection uri

* fix: restore missing _id in table column

* fix: workspace model support

* chore: add verbose playwight reporting

* chore: update bson-ext to bson for workspace-related code

* fix: dburi should not be random

* fix: drop form collection instead of the whole db

* chore: update hosting port from 5000 to 5001 for playwright

* fix: replace bson-ext with bson

* Revert "chore: update hosting port from 5000 to 5001 for playwright"

This reverts commit e5db025.

* fix: workspace spec, exists returning null and doc instead of boolean

* chore: remove commented code

* chore: remove confusing statement

* chore: remove unneeded comments

* chore: remove duplicated typedef

* Revert "chore: remove duplicated typedef"

This reverts commit 66f638f.

---------

Co-authored-by: foochifa <[email protected]>
@KenLSM KenLSM mentioned this pull request Jan 15, 2024
kathleenkhy pushed a commit that referenced this pull request Jan 23, 2024
* chore: bump mongoose to 6.12

* fix: type mismatch on cursorquery, objectid

* fix: required and validator shape in user and form model

* fix: use try catch block for mongoose connect loader

* fix: add missing goLinkSuffix property in IForm

* fix: overwrite typing of IPaymentSchema for mongoose Id

* fix: querycursor import in submission.ts

* fix: removed undefined in AgencySchema causing schema methods to be never

* fix: schema typings in form logic and sms types

* fix: replace ConnectionOptions with ConnectOptions

* fix: remove deprecated connect options

* fix: objectid imports

* chore: remove mongodb package, upgrade connect-mongo to 4.6.0

* chore: replace mongoerror import reference

* fix: typescript errors

* chore: change nModified to modifiedCount

* fix: typeerror on form_statistics_total.server.model

* fix: typeerror on bouncemodel

* fix: form server model, only fixed affected methods

* fix: mongoerror is now mongoservererror

* fix: execPopulate no longer required to be called

* fix: verification.model

* fix: replace enforcedocument to hydrateddocument

* fix: duplicateFormFieldByIdAndIndex

* fix: util/logic.ts type inference errors

* refactor: swap bson with bson-ext

* chore: update test db configs

* refactor: remove bson reference

* refactor: gloal replacement of bson

* chore: remove execPopulate

* fix: void promise returns

* fix: remove bson reference with mongoose

* fix: replace more bson on admin-forms.form.routes.specs

* fix: test failures on admin-forms.submissions.routes.spec

* fix: test failures on src/app/models

* fix: test failures on src/app/modules/payments

* fix: test failures on src/app/modules/issues

* fix: form model always defaulting to private mode on save

* chore: remove bson in jest-db

* fix: lint and type errors in loader

* chore: remove unused typedef

* chore: remove commented out BSON code

* fix: playwright mongod init failure

* refactor: rename constants

* fix: mongoose loader

* fix: removed form model business field to be required

* fix: e2e email-submission tests

* fix: make mongoose.connect to be async

* fix: add specific db connection uri

* fix: restore missing _id in table column

* fix: workspace model support

* chore: add verbose playwight reporting

* chore: update bson-ext to bson for workspace-related code

* fix: dburi should not be random

* fix: drop form collection instead of the whole db

* chore: update hosting port from 5000 to 5001 for playwright

* fix: replace bson-ext with bson

* Revert "chore: update hosting port from 5000 to 5001 for playwright"

This reverts commit e5db025.

* fix: workspace spec, exists returning null and doc instead of boolean

* chore: remove commented code

* chore: remove confusing statement

* chore: remove unneeded comments

* chore: remove duplicated typedef

* Revert "chore: remove duplicated typedef"

This reverts commit 66f638f.

---------

Co-authored-by: foochifa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MongoDB host with srv scheme is not supported
3 participants