Merge pull request #860 from horiaradu/master
fix nin support for in memory datasource
This commit is contained in:
commit
b7543e9402
|
@ -562,6 +562,15 @@ function applyFilter(filter) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (example.nin) {
|
||||||
|
for (var i = 0; i < example.nin.length; i++) {
|
||||||
|
if (example.nin[i] == value) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ('neq' in example) {
|
if ('neq' in example) {
|
||||||
return compare(example.neq, value) !== 0;
|
return compare(example.neq, value) !== 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,6 +358,34 @@ describe('Memory connector', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should successfully extract 3 users with inq', function (done) {
|
||||||
|
User.find({
|
||||||
|
where: {
|
||||||
|
seq: {
|
||||||
|
inq: [0, 1, 5]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, function (err, users) {
|
||||||
|
should.not.exist(err);
|
||||||
|
users.length.should.be.equal(3);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should successfully extract 4 users with nin', function (done) {
|
||||||
|
User.find({
|
||||||
|
where: {
|
||||||
|
seq: {
|
||||||
|
nin: [2, 3]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, function (err, users) {
|
||||||
|
should.not.exist(err);
|
||||||
|
users.length.should.be.equal(4);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should count using date string', function(done) {
|
it('should count using date string', function(done) {
|
||||||
User.count({ birthday: { lt: new Date(1990, 0).toISOString() }},
|
User.count({ birthday: { lt: new Date(1990, 0).toISOString() }},
|
||||||
function(err, count) {
|
function(err, count) {
|
||||||
|
|
Loading…
Reference in New Issue