Created
May 8, 2015 05:32
-
-
Save badmonster0/71638f362b4405551336 to your computer and use it in GitHub Desktop.
await User.findById(id).exec()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//mongo built in promise | |
let user = await User.findById(id).exec() | |
//prefered, consitent with the pattern that how we use await/promise/nodeify | |
let user = await User.promise.findById(id) | |
//they have the same result, they return the same promise. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment