fix db.incrObjectFieldBy for mongo

convert string to int
This commit is contained in:
barisusakli
2016-09-23 13:42:14 +03:00
parent c4f82a3f60
commit cd9e2d17a3
2 changed files with 13 additions and 3 deletions

View File

@@ -231,9 +231,11 @@ module.exports = function(db, module) {
module.incrObjectFieldBy = function(key, field, value, callback) {
callback = callback || helpers.noop;
if (!key) {
value = parseInt(value, 10);
if (!key || isNaN(value)) {
return callback();
}
var data = {};
field = helpers.fieldToString(field);
data[field] = value;