electerious / Ackee

Self-hosted, Node.js based analytics tool for those who care about privacy.
https://ackee.electerious.com
MIT License
4.27k stars 359 forks source link

Upgrade mongoose 6.x to 8.x #377

Open yehudab opened 9 months ago

yehudab commented 9 months ago

🐣 Is your feature request related to a problem? Please describe.

I use MongoDB Atlas to host my database, and recently received an email regarding upcoming upgrade of my instance to version 7.0.

Message highlights:

Your M0/M2/M5 Atlas cluster(s) will be automatically upgraded to MongoDB 7.0 in February 2024. ... To ensure a seamless transition, we recommend updating your driver version to ensure continued compatibility with your applications

πŸ’‘ Describe the solution you'd like

According to the docs, MongoDB 7.0 requires mongodb npm package version 5.7 or higher. The current code uses version 4.12.1 (a dependent of mongoose@6.3.1).

For maximum future compatibility, I suggest upgrading to the latest mongoose version (8.0.3). This version uses mongodb@6.2.0.

❓ Describe alternatives you've considered

While it was possible to use MongoDB 7.0 with mongoose@7.6.7, I think it is better to upgrade to the latest mongoose version. The downside of this, is that it will require changing the minimum node version to 16. (mongodb 5.7 can run on node 14).

πŸ“‹ Additional context

It appears that the simple path of upgrading to latest mongoose via yarn upgrade --latest mongoose works out of the box. It then required fixing the minimum node versions in a few places. Local tests seems to run fine, as well as my own installation via fly.io. It appears that tests on GitHub are extremely unstable at this point. Not sure why. After a few reties the tests are passing.

A PR will be submitted shortly