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

how to use "!is" by array ? #124

Open
Iamlars opened this issue Aug 26, 2016 · 2 comments
Open

how to use "!is" by array ? #124

Iamlars opened this issue Aug 26, 2016 · 2 comments

Comments

@Iamlars
Copy link

Iamlars commented Aug 26, 2016

I want to filter data use !is like '{city:{"!is": ["a","b","c"]}}',but it is not work well.

@IvanBrkicNeuralab
Copy link

IvanBrkicNeuralab commented Jan 25, 2017

I had a similar issue:

product=[
  {
    "attributes":{"attribute_pa_excitation_emission":"350-448","pa_size":"200-assays"}
  },
  {
    "attributes":{"attribute_pa_excitation_emission":"800-448","pa_size":"100-assays"}
  }
];
db = TAFFY();

product.forEach(function(el) {
  db.insert(el);
});

I can filter for "pa_size" but not for attribute_pa_excitation_emission

search = baza({'attributes':{"pa_size":"200-assays"}}).get(); //finds results
search = baza({'attributes':{"attribute_pa_excitation_emission":"800-448"}}).get(); // nothing

After 2 days i found out the rule: If the string contains "is" - no go. Any other string works good. Hope this helps someone.

@TyeS2K
Copy link

TyeS2K commented Mar 20, 2019

!is also fails with number arrays. You can play with this sample and toggle the "is" operator to see the failure.

`        var people= TAFFY();
        people.insert({"fname":"Bruce","lname":"Wayne", "age": 18});
        people.insert({"fname":"Peter","lname":"Parker", "age": 18});
        people.insert({"fname":"Clark","lname":"Kent", "age": 23});
        people.insert({"fname":"Tyrone","lname":"Lee", "age": 43});
        people.insert({"fname":"Linda","lname":"Lee", "age": 39});
      
      	write("people({age: {'!is': [39, 18, 43]}}).get()");
        write("people().count()");
        write("people().first()");
        write("people().select('fname')");
        
        write("people.sort('fname desc');people().select('fname')");
         function write(func){
            var ret = eval(func);
            var output = (typeof ret === 'object') ? JSON.stringify(ret) : ret;
            document.getElementById('results').innerHTML+= '<li>' + func + '<br />=><b>'+output+'</b>';
        }

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