Skip to content

Instantly share code, notes, and snippets.

@clauda
Created March 27, 2013 06:35
Show Gist options
  • Save clauda/5252205 to your computer and use it in GitHub Desktop.
Save clauda/5252205 to your computer and use it in GitHub Desktop.
Mongoose Promisse Sample
var Promise = require('mongoose').Promise
, promise = new Promise;
User.findById(_userId).exec(function(err, guy) {
if(err) {
promise.error(err);
return;
}
promise.complete(guy);
});
return promise;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment