Created
January 15, 2013 22:35
-
-
Save astrotars/4542814 to your computer and use it in GitHub Desktop.
Update w/ Mongoose [casts values to appropriate types but does not run validators, middleware, defaults, or setters]
This file contains hidden or 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
| // assign update client to var | |
| var updateclient = req.body; | |
| remove default to avoid mongo errors (like Mod on _id not allowed) | |
| delete updateclient._id; | |
| Client.update({_id: req.params.client_id}, updateclient, {}, function(err, client) { | |
| if (err) | |
| return next(new restify.InternalError(err)); | |
| res.send(req.body); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment