diff --git a/lib/adapters/redis2.js b/lib/adapters/redis2.js index 35012c41..2dd4893d 100644 --- a/lib/adapters/redis2.js +++ b/lib/adapters/redis2.js @@ -60,7 +60,7 @@ var commands = Object.keys(redis.Multi.prototype).filter(function (n) { commands.forEach(function (cmd) { Client.prototype[cmd] = function (args, callback) { - + var c = this._client, log; if (typeof args === 'string') { @@ -389,6 +389,7 @@ BridgeToRedis.prototype.all = function all(model, filter, callback) { if (indexes && indexes.length) { innerSetUsed = true; if (indexes.length > 1) { + indexes.unshift(dest); trans.sinterstore(indexes); } else { dest = indexes[0]; diff --git a/test/common_test.js b/test/common_test.js index fb34e633..6c243f13 100644 --- a/test/common_test.js +++ b/test/common_test.js @@ -419,6 +419,16 @@ function testOrm(schema) { }); + + it('should find records filtered with multiple attributes', function (test) { + Post.create({title: 'title', content: 'content', published: true, date: 1}, function (err, post) { + Post.all({where: {title: 'title', date: 1}}, function (err, res) { + test.ok(res.length > 0, 'Exact match with string returns dataset'); + test.done(); + }); + }); + }); + it('should handle hasMany relationship', function (test) { User.create(function (err, u) { if (err) return console.log(err);