Skip to content

MongooseError: Model.prototype.save() no longer accepts a callback in lesson 378 resolved  #30

@bommmi999

Description

@bommmi999

if anyone face the above situation use promise instead of a callback function
for example :
// User.findOne({ email: username }, function (err, foundUser) {
// if (err) {
// console.log(err);
// } else {
// if (foundUser.password === password) {
// res.render("secrets");
// }
// }
// });
the above code can be rewritten using promises below
User.findOne({ email: username })
.then((foundUser) => {
if (foundUser.password === password) {
res.render("secrets");
}
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions