diff --git a/lib/adapters/redis2.js b/lib/adapters/redis2.js index f76ec516..35012c41 100644 --- a/lib/adapters/redis2.js +++ b/lib/adapters/redis2.js @@ -215,6 +215,12 @@ BridgeToRedis.prototype.save = function (model, data, callback) { if (err) return callback(err); this.client.hmset([model + ':' + data.id, data], function (err) { if (err) return callback(err); + if (prevData) { + Object.keys(prevData).forEach(function (k) { + if (data.hasOwnProperty(k)) return; + data[k] = prevData[k]; + }); + } this.updateIndexes(model, data.id, data, callback, this.forDb(model, prevData)); }.bind(this)); }.bind(this)); diff --git a/package.json b/package.json index d1c172da..733ed2b3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jugglingdb", "description": "ORM for every database: redis, mysql, neo4j, mongodb, postgres, sqlite", - "version": "0.1.18", + "version": "0.1.20", "author": "Anatoliy Chakkaev ", "contributors": [ { "name": "Anatoliy Chakkaev", "email": "rpm1602@gmail.com" },