Stats

Contributors: 1 Sunday, July 16, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

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