Skip to content

Instantly share code, notes, and snippets.

@badmonster0
Created May 8, 2015 05:32
Show Gist options
  • Save badmonster0/71638f362b4405551336 to your computer and use it in GitHub Desktop.
Save badmonster0/71638f362b4405551336 to your computer and use it in GitHub Desktop.
await User.findById(id).exec()
//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