Skip to content

Instantly share code, notes, and snippets.

@dustinc
Created September 21, 2012 19:30
Show Gist options
  • Save dustinc/3763417 to your computer and use it in GitHub Desktop.
Save dustinc/3763417 to your computer and use it in GitHub Desktop.
controller.profile.save = function(req, res, next) {
var Profile = db.main.model('Profile'),
profile = req.body.profile;
Profile.findOne({'_id': profile.id}, function(err, _profile) {
if(err) return next(err);
if(null == _profile) {
_profile = new Profile(profile);
}
console.log(_profile);
});
res.send('profile save');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment