public interface Selector
Interface that identifies all Operation
s and Expression
s that can form
the basis of a selector.
Obtain a selector from an Operation
or Expression
. For example:
// Selector for the field "year" equal to 2017, JSON form "year": {"$eq": 2017}
Selector expressionSelector = eq("year", 2017);
// Selector for the field "name" equal to "example" and the field "year" less than 2017
// JSON form "$and": [{"name": {"$eq": "example"}}, {"year": {"$lt": 2017}}]
Selector operationSelector = and(eq("name", "example"), lt("year", 2017));
For convenience and code brevity use the static imports for the operations and expressions you need. For example:
import static com.cloudant.client.api.query.Expression.eq;
import static com.cloudant.client.api.query.Expression.lt;
import static com.cloudant.client.api.query.Operation.and;