Stops execution at await
suggest changeawait pauses that async function until the promise settles. It does not stop the rest of the process. The promise can resolve to a value or to undefined. This snippet is not valid at the top level of a CommonJS file. It has to sit inside an async function.
try {
await User.findByIdAndUpdate(user._id, {
$push: {
tokens: token
}
}).exec()
} catch (e) {
handleError(e)
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents