public class Expression extends java.lang.Object implements Selector
Expression
s are used to evaluate true/false criteria to select documents. For example,
an expression to select documents where the field "widget_count" is equal to 5 would be
constructed as follows
Expression e = Expression.eq("widget_count", 5);
Modifier and Type | Method and Description |
---|---|
static Expression |
all(java.lang.String lhs,
java.lang.Object... rhs)
Matches an array value if it contains all the elements of the argument array
|
static Expression |
eq(java.lang.String lhs,
java.lang.Object rhs)
The field is equal to the argument
|
static Expression |
exists(java.lang.String lhs,
boolean rhs)
Check whether the field exists or not, regardless of its value
|
static Expression |
gt(java.lang.String lhs,
java.lang.Object rhs)
The field is greater than the argument
|
static Expression |
gte(java.lang.String lhs,
java.lang.Object rhs)
The field is greater than or equal to the argument
|
static Expression |
in(java.lang.String lhs,
java.lang.Object... rhs)
The document field must exist in the list provided
|
static Expression |
lt(java.lang.String lhs,
java.lang.Object rhs)
The field is less than the argument
|
static Expression |
lte(java.lang.String lhs,
java.lang.Object rhs)
The field is less than or equal to the argument
|
static Expression |
mod(java.lang.String lhs,
java.lang.Long divisor,
java.lang.Long remainder)
Divisor and Remainder are both positive or negative integers.
|
static Expression |
ne(java.lang.String lhs,
java.lang.Object rhs)
The field is not equal to the argument
|
static Expression |
nin(java.lang.String lhs,
java.lang.Object... rhs)
The document field must not exist in the list provided
|
static Expression |
regex(java.lang.String lhs,
java.lang.String rhs)
A regular expression pattern to match against the document field.
|
static Expression |
size(java.lang.String lhs,
java.lang.Long rhs)
Special condition to match the length of an array field in a document.
|
java.lang.String |
toString() |
static Expression |
type(java.lang.String lhs,
Type rhs)
Check the document field's type
and object
|
public static Expression lt(java.lang.String lhs, java.lang.Object rhs)
lhs
- The field to comparerhs
- The argument for the comparisonpublic static Expression lte(java.lang.String lhs, java.lang.Object rhs)
lhs
- The field to comparerhs
- The argument for the comparisonpublic static Expression eq(java.lang.String lhs, java.lang.Object rhs)
lhs
- The field to comparerhs
- The argument for the comparisonpublic static Expression ne(java.lang.String lhs, java.lang.Object rhs)
lhs
- The field to comparerhs
- The argument for the comparisonpublic static Expression gte(java.lang.String lhs, java.lang.Object rhs)
lhs
- The field to comparerhs
- The argument for the comparisonpublic static Expression gt(java.lang.String lhs, java.lang.Object rhs)
lhs
- The field to comparerhs
- The argument for the comparisonpublic static Expression exists(java.lang.String lhs, boolean rhs)
lhs
- The field to checkrhs
- The argument (true or false)public static Expression type(java.lang.String lhs, Type rhs)
lhs
- The field to checkrhs
- The typepublic static Expression in(java.lang.String lhs, java.lang.Object... rhs)
lhs
- The field to checkrhs
- The argument - one or more valuespublic static Expression nin(java.lang.String lhs, java.lang.Object... rhs)
lhs
- The field to checkrhs
- The argument - one or more valuespublic static Expression size(java.lang.String lhs, java.lang.Long rhs)
lhs
- The field to checkrhs
- The length of the arraypublic static Expression mod(java.lang.String lhs, java.lang.Long divisor, java.lang.Long remainder)
lhs
- The field to checkdivisor
- The divisor argument of the mod operationremainder
- The remainder argument of the mod operationpublic static Expression regex(java.lang.String lhs, java.lang.String rhs)
lhs
- The field to matchrhs
- The regular expressionpublic static Expression all(java.lang.String lhs, java.lang.Object... rhs)
lhs
- The field to matchrhs
- The argumentspublic java.lang.String toString()
toString
in class java.lang.Object