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

OR into where conditions #351

Closed zeitungen closed 10 years ago

zeitungen commented 10 years ago

Hello, I try to do query with OR into my conditions. The goal is to make some SQL (or the equivalent into nosql databases) query like (in basic case):

SELECT .... WHERE id = 1 OR something = 42

It's possible with jugglingdb ? If not, we could start discussion about how implement this feature ?

Thanks for your attention.

dgsan commented 10 years ago

Mysql adapter can do OR. I think you just pass the where conditions in as an array, but check the unit tests if it's not on the read me.

zeitungen commented 10 years ago

I don't find a test for OR condition or a test use an OR condition. @dgsan, if you have an example, I would like to see it, please. I'll make a pull request for add OR test, in future

dgsan commented 10 years ago

https://github.com/jugglingdb/mysql-adapter/blob/master/test/basic-querying.test.js#L28

https://github.com/jugglingdb/mysql-adapter#using-or-and-in-operator

I don't know about other adapters or if it's applicable to you since I don't know what DB you're using.

zeitungen commented 10 years ago

Thanks.

At the moment, I work with sqlite3 but I hope to switch easily to others db with same features