Search code examples
c#aerospike

what is equivalent with "IN" operator in Aerospike?


I have a set by this structure and data:

+--------+-----------+---------+
| MODEL  | COLOR     | OWNER   |
+--------+-----------+---------+
|Benz    | Red       | p1      |
+--------+-----------+---------+
|BMW     | Blue      | P2      |
+--------+-----------+---------+
|Ferrari | YelloW    | P3      |
+--------+-----------+---------+
|Audi    | Blue      + P4      |
--------------------------------

now want to search in aerospike for just yellow and blue cars. I search in aerospike documentation in both AQL and Query section but I cannot find any things. I want to simulate this SQL query in aerospike with C# client:

Select * from cars where color in ('Yellow', 'Red')


Solution

  • Aerospike recently updated Predicate Filters to Expressions. Currently clients and server will support both but at some point Predicate Filters will be deprecated. Expressions are more intuitive in syntax, achieve the same functionality as Predicate Filters and further extend it. For C#, this link should show you the code example: https://github.com/aerospike/aerospike-client-csharp/blob/master/Framework/AerospikeDemo/QueryExp.cs