1602 / jugglingdb

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

jugglingdb-redis should check for empty object in filter.where #318

Closed origin1tech closed 11 years ago

origin1tech commented 11 years ago

had issue when filter where is empty object. Seems it should check if the object is empty that way you can consistently pass default { where: {} } and don't have to check for empty object in your route/method.

something as simple as:

var emptyWhere = filter && JSON.stringify(filter.where) === '{}' ? true : false;

1602 commented 11 years ago

What kind of issue do you have?

origin1tech commented 11 years ago

passing in { where: {} } which is the default throws an error, should check for this otherwise you have to check before sending the query to the adapter. Or at least it seems to me it should work that way to me. So the above fixed the issue. if the "filter.where" is an empty object it ignores the if(filter.where) sequence if that makes sense. I have a bunch of other little adapter improvements, minor fixes that I can send your way and if you like them I'll do a pull request. to push them up. thx. Do you guys have an IRC Channel?