From 0daa01425b31b5cb6743f20a3d93ad1774b19ef0 Mon Sep 17 00:00:00 2001 From: caofb65 Date: Sat, 16 Aug 2014 22:11:56 +0800 Subject: [PATCH 1/3] flter handleKeys result,client.multi may return null when key does not exist,so we exclude null value --- lib/redis.js | 4 ++-- package.json | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/redis.js b/lib/redis.js index 762defb..396b504 100644 --- a/lib/redis.js +++ b/lib/redis.js @@ -2,7 +2,7 @@ * Module dependencies */ var redis = require('redis'); - +var _=require('lodash'); exports.initialize = function initializeSchema(schema, callback) { if (!redis) return; @@ -548,7 +548,7 @@ BridgeToRedis.prototype.all = function all(model, filter, callback) { if (err) { return callback(err); } - + replies=_.filter(replies, function(value) { return value !== null; }); var objs = (replies || []).map(function (r) { return redis.fromDb(model, r); }); diff --git a/package.json b/package.json index d0b40af..a26631a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jugglingdb-redis", - "version": "0.0.2-2", + "version": "0.0.2-3", "description": "Redis adapter for jugglingdb", "main": "index.js", "author": "Anatoliy Chakkaev ", @@ -18,7 +18,8 @@ "test": "make test" }, "dependencies": { - "redis": "= 0.7.2" + "redis": "= 0.7.2", + "lodash": "^2.4.1" }, "devDependencies": { "jugglingdb": "https://github.com/1602/jugglingdb/archive/master.tar.gz", From 18025482a81714730d4ef4c509767b807908795e Mon Sep 17 00:00:00 2001 From: caofb Date: Mon, 18 Aug 2014 21:51:52 +0800 Subject: [PATCH 2/3] remove lodash --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index a26631a..73dc070 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,7 @@ "test": "make test" }, "dependencies": { - "redis": "= 0.7.2", - "lodash": "^2.4.1" + "redis": "= 0.7.2" }, "devDependencies": { "jugglingdb": "https://github.com/1602/jugglingdb/archive/master.tar.gz", From 26e261ce99745272fbdc7a893751eb1d9b1ec7bc Mon Sep 17 00:00:00 2001 From: caofb Date: Mon, 18 Aug 2014 21:53:38 +0800 Subject: [PATCH 3/3] remove lodash --- lib/redis.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/redis.js b/lib/redis.js index 396b504..197124e 100644 --- a/lib/redis.js +++ b/lib/redis.js @@ -2,7 +2,6 @@ * Module dependencies */ var redis = require('redis'); -var _=require('lodash'); exports.initialize = function initializeSchema(schema, callback) { if (!redis) return; @@ -548,7 +547,8 @@ BridgeToRedis.prototype.all = function all(model, filter, callback) { if (err) { return callback(err); } - replies=_.filter(replies, function(value) { return value !== null; }); + if(Array.isArray(replies)) + replies=replies.filter(function(value) { return value !== null; }); var objs = (replies || []).map(function (r) { return redis.fromDb(model, r); });