Stops execution at await

suggest change

await 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)
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents