Stats

Contributors: 1
2017-07-16
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook

Stops execution at await

Download node.js eBook

Example

If the promise doesn't return anything, the async task can be completed using await.

try{
    await User.findByIdAndUpdate(user._id, {
        $push: {
            tokens: token
        }
    }).exec()
}catch(e){
    handleError(e)
}