Navid_pdp11
Navid_pdp11

Reputation: 4022

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')

Upvotes: 2

Views: 190

Answers (2)

pgupta
pgupta

Reputation: 5415

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

Upvotes: 2

pgupta
pgupta

Reputation: 5415

Color IN (Yellow, Red) would logically be same as Color==Yellow OR Color==Red. You can build such an Expression to filter the query. See example in response to : using multiple logical operations like OR,AND,NOT in Aerospike

For C# client see: QueryExp.cs in the Csharp client code / Framework/AerospikeDemo

Upvotes: 3

Related Questions