Not Equals Replacement for Aerospike

77 views Asked by At

Since PredExps have been deprecated since aerospike client version 6.x.x onwards for Java, what is the corresponding Filter Expression replacement for the notEquals functionality that PredExps provided?

For example:

predicate = Arrays.asList(PredExp.stringBin(key), PredExp.stringValue(String.valueOf(value)),PredExp.stringEqual(),PredExp.not());

What is the Filter Expression equivalent of this?

I tried using a combination of Filter Expression for this but even that is not working.

1

There are 1 answers

2
Roi Menashe On

Aerospike Filter Expression for "not equal" is ne, checkout: https://docs.aerospike.com/server/guide/expressions/comparison#ne

Also a good place to look is the Aerospike Java Client project on GitHub: https://github.com/aerospike/aerospike-client-java It contains some tests and code examples that uses ne.

For example, the code below find records where bin age is not an integer.

Expression exp = Exp.build(
  Exp.ne(Exp.binType("age"), Exp.val(ParticleType.INTEGER)

For your case it would be something like:

Exp.ne(Exp.stringBin("binName"), Exp.val("stringValue"))