Loading ...
Sorry, an error occurred while loading the content.

Is there a way to do a not in query?

Expand Messages
  • mattrq80
    As far as I can see the operator for negation is added on to the comparison e.g. !IS . As there is no comparator string for IN which is represented as
    Message 1 of 1 , Jul 12, 2013
    • 0 Attachment
      As far as I can see the operator for negation is added on to the comparison e.g. '!IS'.

      As there is no comparator string for IN which is represented as "db({id:[1,2,3]})" it would seem there is no way to do a "NOT IN" query.


      I have tried the following with little success:
      var db = new TAFFY([
      {id:1, title:'Test1'},
      {id:2, title:'Test2'},
      {id:3, title:'Test3'},
      {id:4, title:'Test4'}
      ]);
      console.log(db({id:{'!IS':[1,2,3]}}).get().length); // 4
      console.log(db({id:{'IS':[1,2,3]}}).get()); // 0
      console.log(db({id:[1,2,3]}).get().length); // 3
      console.log(db({id:{'IN':[1,2,3]}}).get().length); // 0
      console.log(db({id:{'!IN':[1,2,3]}}).get().length); // 4

      Please let me know if there is a way of achieving this that I am not aware of.

      Thanks,
      Matt
    Your message has been successfully submitted and would be delivered to recipients shortly.