fixed $inc not updating values of 0

This commit is contained in:
Ritchie Martori
2012-07-02 18:23:45 -07:00
parent 1e013861cd
commit e13f30e7c5
2 changed files with 2 additions and 2 deletions

View File

@@ -128,7 +128,6 @@ Collection.prototype.sanitize = function (body) {
*/
Collection.prototype.handle = function (ctx) {
// set id one wasnt provided in the query
ctx.query.id = ctx.query.id || this.parseId(ctx) || (ctx.body && ctx.body.id);
@@ -509,6 +508,7 @@ Collection.prototype.execCommands = function (type, obj, commands) {
var val = commands[key][k];
if(k === '$inc') {
if(!obj[key]) obj[key] = 0;
obj[key] += val;
}
if(k === '$push') {

File diff suppressed because one or more lines are too long