1602 / jugglingdb

Multi-database ORM for nodejs: redis, mongodb, mysql, sqlite3, postgresql, arango, in-memory...
http://1602.github.io/jugglingdb/
2.05k stars 241 forks source link

Memory adapter: throws an exception when filtering on a "null" field #410

Closed AnAppAMonth closed 10 years ago

AnAppAMonth commented 10 years ago

In function applyFilter(), in function test():

if (typeof example === 'object') {
    if (example.inq) {
        ...
    }
}

The problem is: null is also an object, and it doesn't have an inq field.

Change it to something like this should solve the problem:

if (typeof example === 'object') {
    if (example === null) {
        return value === null;
    }
    if (example.inq) {
        ...
    }
}