Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not condition with in operator? #141

Open
natarajgandhi opened this issue Jun 20, 2017 · 2 comments
Open

not condition with in operator? #141

natarajgandhi opened this issue Jun 20, 2017 · 2 comments

Comments

@natarajgandhi
Copy link

Hi,

I am trying to write a query to filter for array of values which do not belong to a column. Basically, trying to write a "not in" a set of values condition.

Kindly advise if I can achieve the same with Taffy. Went through the documentation in http://taffydb.com/writing_queries.html, however, couldn't locate a not in condition. Kindly advise.

Thanks and Regards,
Nataraj

@shawnsBrain
Copy link

DB({column:{"!is":["val1","val2","val3"]}})

@chrisregnier
Copy link

There seems to be a bug here.

let DB = taffy( [ { myCol : 'val1' } ] );
assert(DB().count(), 1);   // only 1 record
assert(DB( { myCol: { 'is': [ 'val1', 'val2' ] } }).count(), 1);   //  myCol IN ['val1', 'val2']  as expected
assert(DB( { myCol: { 'is': [ 'val2', 'val1' ] } }).count(), 1);   //  reverse order and myCol IN ['val2', 'val1']  as expected
assert(DB( { myCol: { 'is': [ 'val3', 'val2' ] } }).count(), 0);   // myCol IN ['val3', 'val2']  is false as expected
assert(DB( { myCol: { '!is': ['val1', 'val2'] } }).count(), 0);   //  myCol NOT IN  ['val1', 'val2']  seems to return nothing as expected

assert(DB( { myCol: { '!is': ['val2', 'val1'] } }).count(), 0);   // fail, it returns the record.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants