Skip to content

chore: Upgrade Mongoose from 5.13.23 to 6.13.6#2243

Closed
lucaslobatob wants to merge 8 commits intostagefrom
chore/mongoose-update
Closed

chore: Upgrade Mongoose from 5.13.23 to 6.13.6#2243
lucaslobatob wants to merge 8 commits intostagefrom
chore/mongoose-update

Conversation

@lucaslobatob
Copy link
Collaborator

Description

This pull request updates Mongoose from version 5.13.23 to 6.13.6 and refactors parts of the code to ensure full compatibility with the new version. The update required adjustments to typing, ObjectId handling, and connection configuration.
As part of this migration, several methods and functions have been updated to use TypeScript typing, improving overall type safety, making better use of TypeScript inference capabilities, and reducing the risk of runtime errors. Additionally, the use of Types.ObjectId has been standardized to use Mongoose's new Types.ObjectId(), ensuring correct typing and consistency with the current Mongoose API.
The MongoDB connection configuration has also been optimized. The following obsolete options have been removed: useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex. These options are no longer supported in Mongoose v6. The library now behaves as if useNewUrlParser, useUnifiedTopology, and useCreateIndex are always set to true, and useFindAndModify to false. Keeping these options in the configuration generates warnings and is unnecessary, therefore they have been safely removed.
No business logic was modified in this PR. The changes are focused exclusively on dependency upgrade, internal refactoring, and improving type correctness. The application was validated to ensure that database connections initialize correctly and that CRUD operations continue to function as expected without regressions.
Overall, this update modernizes the codebase, removes deprecated configurations, and strengthens type safety across the project.

Related Ticket #2230

Testing

Provide relevant testing instructions. What scenarios are impacted? What build may be necessary to test this change?

Developer Checklist

General

  • No console.log or related logging is added.
  • No code is repeated/duplicated in violation of DRY. The exception to this is for new (MVP/Prototype) functionality where the abstraction layer may not be clear (comments should be added to explain the violation of DRY in these scenarios).

Backend Changes

  • All endpoints are appropriately secured with Middleware authentication
  • All new endpoints have a interface schema defined

Tests

  • All existing unit and end to end tests pass across all services
  • Unit and end to end tests have been added to ensure backend APIs behave as expected

Test IDs

  • Include the test ID when adding new tasks or components.
  • Check that test IDs are present in the modified components.

Merge Request Review Checklist

  • An issue is linked to this PR and these changes meet the requirements outlined in the linked issue(s)
  • High risk and core workflows have been tested and verified in a local environment.
  • Enhancements or opportunities to improve performance, stability, security or code readability have been noted and documented in Project do Github issues if not being addressed.
  • Any dependent changes have been merged and published in downstream modules
  • Changes to multiple services can be deployed in parallel and independently. If not, changes should be broken out into separate merge requests and deployed in order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant