Mongoose async/await find then edit and save?

Viewed 17890

Is it possible to do a find then save using async/await promise?

I have the following code:

try {
    var accounts = await Account.find()
    .where("username").in(["email@gmail.com"])
    .exec();
    accounts.password = 'asdf';
    accounts.save();
} catch (error) {
    handleError(res, error.message);
}

and I am getting the following error:

ERROR: accounts.save is not a function
1 Answers
Related