Mongoose version upgrade

Even if you upgrade MongoDB to version 6.x, you can still use Mongoose versions below 6.x.
However, if you update Mongoose, keep in mind that Mongoose is a wrapper around the MongoDB Node.js driver.
This means that updating Mongoose will also update underlying Node.js driver version. Therefore, you should carefully check all changes between the current and new versions of both Mongoose and the Node.js driver.
Some APIs may be deprecated, some types might change, and new features could be added. it’s crucial to evaluate these changes and select the best version that fits you server’s requirements.

For example, I needed the ability to return data outside of the withTransaction() helper callback, which is supported starting from the 6.x version of the MongoDB Node.js driver. As a result, I chose Mongoose 8.x, which uses a driver version higher than 6.x.
Additionally, if you’re using mongodb-memory-server for testing purposes, make sure to update its binary version to match the database version you’re using.