Upgrade Mongoose to version 5

Multi tool use
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.
node.js mongodb
add a comment |
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.
node.js mongodb
I couldn't find this linked in the current Mongoose documentation, but the GitHub repo does have a helpful Guide to Migrating to Mongoose 5.
– Stennie
Jan 19 at 6:44
Missing a link to the migration guide in the Mongoose 5 documentation was an oversight. The above guide is now published at: mongoosejs.com/docs/migrating_to_5.html.
– Stennie
Jan 24 at 0:12
add a comment |
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.
node.js mongodb
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.
node.js mongodb
node.js mongodb
asked Jan 16 at 17:19
user981783user981783
12
12
I couldn't find this linked in the current Mongoose documentation, but the GitHub repo does have a helpful Guide to Migrating to Mongoose 5.
– Stennie
Jan 19 at 6:44
Missing a link to the migration guide in the Mongoose 5 documentation was an oversight. The above guide is now published at: mongoosejs.com/docs/migrating_to_5.html.
– Stennie
Jan 24 at 0:12
add a comment |
I couldn't find this linked in the current Mongoose documentation, but the GitHub repo does have a helpful Guide to Migrating to Mongoose 5.
– Stennie
Jan 19 at 6:44
Missing a link to the migration guide in the Mongoose 5 documentation was an oversight. The above guide is now published at: mongoosejs.com/docs/migrating_to_5.html.
– Stennie
Jan 24 at 0:12
I couldn't find this linked in the current Mongoose documentation, but the GitHub repo does have a helpful Guide to Migrating to Mongoose 5.
– Stennie
Jan 19 at 6:44
I couldn't find this linked in the current Mongoose documentation, but the GitHub repo does have a helpful Guide to Migrating to Mongoose 5.
– Stennie
Jan 19 at 6:44
Missing a link to the migration guide in the Mongoose 5 documentation was an oversight. The above guide is now published at: mongoosejs.com/docs/migrating_to_5.html.
– Stennie
Jan 24 at 0:12
Missing a link to the migration guide in the Mongoose 5 documentation was an oversight. The above guide is now published at: mongoosejs.com/docs/migrating_to_5.html.
– Stennie
Jan 24 at 0:12
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1395039%2fupgrade-mongoose-to-version-5%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1395039%2fupgrade-mongoose-to-version-5%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
GHkuEJphkB9zqwr 85GISd6 T,hjPgWLhpMSbf90ukv8afMt8bhqhzUytAw6iB7NXNiDYoJ8qsn6X7y,mfD LYz
I couldn't find this linked in the current Mongoose documentation, but the GitHub repo does have a helpful Guide to Migrating to Mongoose 5.
– Stennie
Jan 19 at 6:44
Missing a link to the migration guide in the Mongoose 5 documentation was an oversight. The above guide is now published at: mongoosejs.com/docs/migrating_to_5.html.
– Stennie
Jan 24 at 0:12