Skip to content

Instantly share code, notes, and snippets.

@jperkelens
Created March 16, 2012 00:02
Show Gist options
  • Save jperkelens/2047762 to your computer and use it in GitHub Desktop.
Save jperkelens/2047762 to your computer and use it in GitHub Desktop.
SAVE
var saveUser = function(callback) {
User.update({_id: this._id}, this, callback);
}
User.findOne = function(selector, callback) {
MongoHelper.findOne(selector, collectionName, function(err, result) {
if (err) return callback(err);
result.save = saveUser;
return callback(null, result);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment