0

I'm currently using Mongoose version 4.4.5 for my MEAN stack application. I need to update Mongoose to version 5 or higher to resolve an issue where Mongoose versions prior to 5.0 are incorrectly matched for MongoDB 3.6. MongoDB 3.6 changed the aggregate API from "cursor optional" to "cursor only", and older mongoose versions break this by trying to invoke a deprecated way to ask for an array in response. Since I'm using MongoDB version 4.0.2, this version of MongoDB also makes the cursor option a requirement for the aggregate API.

I'm unable to find specific guidance on how to upgrade Mongoose to version 5.0 using npm. I could use

npm update mongoose@5.0.0

but need to specific guidance on what else I need to do to make sure the new mongoose version correctly connects to MongoDB, that all the schemas and models defined for my current mongoose version transition seamlessly to the new mongoose.

Can someone please provide this guidance? I've never done this before and can't find specific steps anywhere online.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.