public abstract class ExpressionRepresents an expression that can be evaluated to a value within the execution of a com.google.cloud.firestore.Pipeline.
Expressions are the building blocks for creating complex queries and transformations in Firestore pipelines. They can represent:
- Field references: Access values from document fields.
- Literals: Represent constant values (strings, numbers, booleans).
- Function calls: Apply functions to one or more expressions.
The Expression class provides a fluent API for building expressions. You can chain together
method calls to create complex expressions.
Static Methods
abs(Expression numericExpr)
public static Expression abs(Expression numericExpr)Creates an expression that returns the absolute value of numericExpr.
| Parameter | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the absolute value operation. |
abs(String numericField)
public static Expression abs(String numericField)Creates an expression that returns the absolute value of numericField.
| Parameter | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the absolute value operation. |
add(Expression first, Expression second)
public static Expression add(Expression first, Expression second)Creates an expression that adds numeric expressions.
| Parameters | |
|---|---|
| Name | Description |
first |
ExpressionNumeric expression to add. |
second |
ExpressionNumeric expression to add. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the addition operation. |
add(Expression first, Number second)
public static Expression add(Expression first, Number second)Creates an expression that adds numeric expressions with a constant.
| Parameters | |
|---|---|
| Name | Description |
first |
ExpressionNumeric expression to add. |
second |
NumberConstant to add. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the addition operation. |
add(String fieldName, Expression second)
public static Expression add(String fieldName, Expression second)Creates an expression that adds a numeric field with a numeric expression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringNumeric field to add. |
second |
ExpressionNumeric expression to add to field value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the addition operation. |
add(String fieldName, Number second)
public static Expression add(String fieldName, Number second)Creates an expression that adds a numeric field with constant.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringNumeric field to add. |
second |
NumberConstant to add. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the addition operation. |
and(BooleanExpression condition, BooleanExpression[] conditions)
public static BooleanExpression and(BooleanExpression condition, BooleanExpression[] conditions)Creates an expression that performs a logical 'AND' operation.
| Parameters | |
|---|---|
| Name | Description |
condition |
BooleanExpressionThe first BooleanExpression. |
conditions |
BooleanExpression[]Additional BooleanExpressions. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the logical 'AND' operation. |
array(Object[] elements)
public static Expression array(Object[] elements)Creates an expression that creates a Firestore array value from an input object.
| Parameter | |
|---|---|
| Name | Description |
elements |
Object[]The input elements to evaluate in the expression. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the array function. |
array(List<Object> elements)
public static Expression array(List<Object> elements)Creates an expression that creates a Firestore array value from an input object.
| Parameter | |
|---|---|
| Name | Description |
elements |
List<Object>The input elements to evaluate in the expression. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the array function. |
arrayConcat(Expression firstArray, Object[] otherArrays)
public static Expression arrayConcat(Expression firstArray, Object[] otherArrays)Creates an expression that concatenates multiple arrays into a single array.
| Parameters | |
|---|---|
| Name | Description |
firstArray |
ExpressionThe first array expression to concatenate. |
otherArrays |
Object[]Additional arrays to concatenate. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the concatenated array. |
arrayConcat(String firstArrayField, Object[] otherArrays)
public static Expression arrayConcat(String firstArrayField, Object[] otherArrays)Creates an expression that concatenates multiple arrays into a single array.
| Parameters | |
|---|---|
| Name | Description |
firstArrayField |
StringThe field name of the first array to concatenate. |
otherArrays |
Object[]Additional arrays to concatenate. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the concatenated array. |
arrayContains(Expression array, Expression element)
public static BooleanExpression arrayContains(Expression array, Expression element)Creates an expression that checks if an array contains a specified element.
| Parameters | |
|---|---|
| Name | Description |
array |
ExpressionThe expression representing the array. |
element |
ExpressionThe element to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the array contains comparison. |
arrayContains(Expression array, Object element)
public static BooleanExpression arrayContains(Expression array, Object element)Creates an expression that checks if an array contains a specified element.
| Parameters | |
|---|---|
| Name | Description |
array |
ExpressionThe expression representing the array. |
element |
ObjectThe element to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the array contains comparison. |
arrayContains(String arrayFieldName, Expression element)
public static BooleanExpression arrayContains(String arrayFieldName, Expression element)Creates an expression that checks if an array contains a specified element.
| Parameters | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array. |
element |
ExpressionThe element to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the array contains comparison. |
arrayContains(String arrayFieldName, Object element)
public static BooleanExpression arrayContains(String arrayFieldName, Object element)Creates an expression that checks if an array contains a specified element.
| Parameters | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array. |
element |
ObjectThe element to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the array contains comparison. |
arrayContainsAll(Expression array, Expression arrayExpression)
public static BooleanExpression arrayContainsAll(Expression array, Expression arrayExpression)Creates an expression that checks if an array contains all of the elements of another array.
| Parameters | |
|---|---|
| Name | Description |
array |
ExpressionThe expression representing the array. |
arrayExpression |
ExpressionThe expression representing the array of values to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the array contains all comparison. |
arrayContainsAll(Expression array, List<Object> values)
public static BooleanExpression arrayContainsAll(Expression array, List<Object> values)Creates an expression that checks if an array contains all of the provided values.
| Parameters | |
|---|---|
| Name | Description |
array |
ExpressionThe expression representing the array. |
values |
List<Object>The values to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the array contains all comparison. |
arrayContainsAll(String arrayFieldName, Expression arrayExpression)
public static BooleanExpression arrayContainsAll(String arrayFieldName, Expression arrayExpression)Creates an expression that checks if an array contains all of the elements of another array.
| Parameters | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array. |
arrayExpression |
ExpressionThe expression representing the array of values to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the array contains all comparison. |
arrayContainsAll(String arrayFieldName, List<Object> values)
public static BooleanExpression arrayContainsAll(String arrayFieldName, List<Object> values)Creates an expression that checks if an array contains all of the provided values.
| Parameters | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array. |
values |
List<Object>The values to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the array contains all comparison. |
arrayContainsAny(Expression array, Expression arrayExpression)
public static BooleanExpression arrayContainsAny(Expression array, Expression arrayExpression)Creates an expression that checks if an array contains any of the elements of another array.
| Parameters | |
|---|---|
| Name | Description |
array |
ExpressionThe expression representing the array. |
arrayExpression |
ExpressionThe expression representing the array of values to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the array contains any comparison. |
arrayContainsAny(Expression array, List<Object> values)
public static BooleanExpression arrayContainsAny(Expression array, List<Object> values)Creates an expression that checks if an array contains any of the provided values.
| Parameters | |
|---|---|
| Name | Description |
array |
ExpressionThe expression representing the array. |
values |
List<Object>The values to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the array contains any comparison. |
arrayContainsAny(String arrayFieldName, Expression arrayExpression)
public static BooleanExpression arrayContainsAny(String arrayFieldName, Expression arrayExpression)Creates an expression that checks if an array contains any of the elements of another array.
| Parameters | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array. |
arrayExpression |
ExpressionThe expression representing the array of values to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the array contains any comparison. |
arrayContainsAny(String arrayFieldName, List<Object> values)
public static BooleanExpression arrayContainsAny(String arrayFieldName, List<Object> values)Creates an expression that checks if an array contains any of the provided values.
| Parameters | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array. |
values |
List<Object>The values to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the array contains any comparison. |
arrayGet(Expression array, Expression offset)
public static Expression arrayGet(Expression array, Expression offset)Creates an expression that returns an element from an array at a specified index.
| Parameters | |
|---|---|
| Name | Description |
array |
ExpressionThe expression representing the array. |
offset |
ExpressionThe index of the element to return. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the element at the specified index. |
arrayGet(Expression array, int offset)
public static Expression arrayGet(Expression array, int offset)Creates an expression that returns an element from an array at a specified index.
| Parameters | |
|---|---|
| Name | Description |
array |
ExpressionThe expression representing the array. |
offset |
intThe index of the element to return. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the element at the specified index. |
arrayGet(String arrayFieldName, Expression offset)
public static Expression arrayGet(String arrayFieldName, Expression offset)Creates an expression that returns an element from an array at a specified index.
| Parameters | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array. |
offset |
ExpressionThe index of the element to return. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the element at the specified index. |
arrayGet(String arrayFieldName, int offset)
public static Expression arrayGet(String arrayFieldName, int offset)Creates an expression that returns an element from an array at a specified index.
| Parameters | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array. |
offset |
intThe index of the element to return. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the element at the specified index. |
arrayLength(Expression array)
public static Expression arrayLength(Expression array)Creates an expression that returns the length of an array.
| Parameter | |
|---|---|
| Name | Description |
array |
ExpressionThe expression representing the array. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the length of the array. |
arrayLength(String arrayFieldName)
public static Expression arrayLength(String arrayFieldName)Creates an expression that returns the length of an array.
| Parameter | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the length of the array. |
arrayReverse(Expression array)
public static Expression arrayReverse(Expression array)Creates an expression that reverses an array.
| Parameter | |
|---|---|
| Name | Description |
array |
ExpressionThe expression representing the array to reverse. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the reversed array. |
arrayReverse(String arrayFieldName)
public static Expression arrayReverse(String arrayFieldName)Creates an expression that reverses an array.
| Parameter | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array to reverse. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the reversed array. |
arraySum(Expression array)
public static Expression arraySum(Expression array)Creates an expression that returns the sum of the elements of an array.
| Parameter | |
|---|---|
| Name | Description |
array |
ExpressionThe expression representing the array. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the sum of the elements of the array. |
arraySum(String arrayFieldName)
public static Expression arraySum(String arrayFieldName)Creates an expression that returns the sum of the elements of an array.
| Parameter | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the sum of the elements of the array. |
byteLength(Expression string)
public static Expression byteLength(Expression string)Creates an expression that calculates the length of a string in UTF-8 bytes, or just the length of a Blob.
| Parameter | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the length of the string in bytes. |
byteLength(String fieldName)
public static Expression byteLength(String fieldName)Creates an expression that calculates the length of a string represented by a field in UTF-8 bytes, or just the length of a Blob.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the length of the string in bytes. |
ceil(Expression numericExpr)
public static Expression ceil(Expression numericExpr)Creates an expression that returns the smallest integer that isn't less than
numericExpr.
| Parameter | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing an integer result from the ceil operation. |
ceil(String numericField)
public static Expression ceil(String numericField)Creates an expression that returns the smallest integer that isn't less than
numericField.
| Parameter | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing an integer result from the ceil operation. |
charLength(Expression string)
public static Expression charLength(Expression string)Creates an expression that calculates the character length of a string expression in UTF8.
| Parameter | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the charLength operation. |
charLength(String fieldName)
public static Expression charLength(String fieldName)Creates an expression that calculates the character length of a string field in UTF8.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the charLength operation. |
collectionId(Expression path)
public static Expression collectionId(Expression path)Creates an expression that returns the collection ID from a path.
| Parameter | |
|---|---|
| Name | Description |
path |
ExpressionAn expression the evaluates to document path. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the collectionId operation. |
collectionId(String pathFieldName)
public static Expression collectionId(String pathFieldName)Creates an expression that returns the collection ID from a path.
| Parameter | |
|---|---|
| Name | Description |
pathFieldName |
StringThe field name of the path. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the collectionId operation. |
concat(Expression first, Object[] others)
public static Expression concat(Expression first, Object[] others)Creates an expression that concatenates expressions together.
| Parameters | |
|---|---|
| Name | Description |
first |
ExpressionThe expression representing the initial value. |
others |
Object[]Optional additional expressions or constants to concatenate. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the concatenated value. |
concat(String fieldName, Object[] others)
public static Expression concat(String fieldName, Object[] others)Creates an expression that concatenates expressions together.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name containing the initial value. |
others |
Object[]Optional additional expressions or constants to concatenate. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the concatenated value. |
conditional(BooleanExpression condition, Expression thenExpr, Expression elseExpr)
public static Expression conditional(BooleanExpression condition, Expression thenExpr, Expression elseExpr)Creates a conditional expression that evaluates to a thenExpr expression if a condition
is true or an elseExpr expression if the condition is false.
| Parameters | |
|---|---|
| Name | Description |
condition |
BooleanExpressionThe condition to evaluate. |
thenExpr |
ExpressionThe expression to evaluate if the condition is true. |
elseExpr |
ExpressionThe expression to evaluate if the condition is false. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the conditional operation. |
conditional(BooleanExpression condition, Object thenValue, Object elseValue)
public static Expression conditional(BooleanExpression condition, Object thenValue, Object elseValue)Creates a conditional expression that evaluates to a thenValue if a condition is true
or an elseValue if the condition is false.
| Parameters | |
|---|---|
| Name | Description |
condition |
BooleanExpressionThe condition to evaluate. |
thenValue |
ObjectValue if the condition is true. |
elseValue |
ObjectValue if the condition is false. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the conditional operation. |
constant(byte[] value)
public static Expression constant(byte[] value)Create a constant for a bytes value.
| Parameter | |
|---|---|
| Name | Description |
value |
byte[]The bytes value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression constant instance. |
constant(Timestamp value)
public static Expression constant(Timestamp value)Create a constant for a Timestamp value.
| Parameter | |
|---|---|
| Name | Description |
value |
com.google.cloud.TimestampThe Timestamp value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression constant instance. |
constant(Blob value)
public static Expression constant(Blob value)Create a constant for a Blob value.
| Parameter | |
|---|---|
| Name | Description |
value |
BlobThe Blob value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression constant instance. |
constant(DocumentReference value)
public static Expression constant(DocumentReference value)Create a constant for a DocumentReference value.
| Parameter | |
|---|---|
| Name | Description |
value |
DocumentReferenceThe DocumentReference value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression constant instance. |
constant(GeoPoint value)
public static Expression constant(GeoPoint value)Create a constant for a GeoPoint value.
| Parameter | |
|---|---|
| Name | Description |
value |
GeoPointThe GeoPoint value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression constant instance. |
constant(VectorValue value)
public static Expression constant(VectorValue value)Create a constant for a VectorValue value.
| Parameter | |
|---|---|
| Name | Description |
value |
VectorValueThe VectorValue value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression constant instance. |
constant(Boolean value)
public static BooleanExpression constant(Boolean value)Create a constant for a Boolean value.
| Parameter | |
|---|---|
| Name | Description |
value |
BooleanThe Boolean value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression constant instance. |
constant(Number value)
public static Expression constant(Number value)Create a constant for a Number value.
| Parameter | |
|---|---|
| Name | Description |
value |
NumberThe Number value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression constant instance. |
constant(String value)
public static Expression constant(String value)Create a constant for a String value.
| Parameter | |
|---|---|
| Name | Description |
value |
StringThe String value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression constant instance. |
constant(Date value)
public static Expression constant(Date value)Create a constant for a Date value.
| Parameter | |
|---|---|
| Name | Description |
value |
DateThe Date value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression constant instance. |
cosineDistance(Expression vector1, Expression vector2)
public static Expression cosineDistance(Expression vector1, Expression vector2)Creates an expression that calculates the cosine distance between two vectors.
| Parameters | |
|---|---|
| Name | Description |
vector1 |
ExpressionThe first vector. |
vector2 |
ExpressionThe second vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the cosine distance. |
cosineDistance(Expression vector1, double[] vector2)
public static Expression cosineDistance(Expression vector1, double[] vector2)Creates an expression that calculates the cosine distance between two vectors.
| Parameters | |
|---|---|
| Name | Description |
vector1 |
ExpressionThe first vector. |
vector2 |
double[]The second vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the cosine distance. |
cosineDistance(String vectorFieldName, Expression vector)
public static Expression cosineDistance(String vectorFieldName, Expression vector)Creates an expression that calculates the cosine distance between two vectors.
| Parameters | |
|---|---|
| Name | Description |
vectorFieldName |
StringThe field name of the first vector. |
vector |
ExpressionThe second vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the cosine distance. |
cosineDistance(String vectorFieldName, double[] vector)
public static Expression cosineDistance(String vectorFieldName, double[] vector)Creates an expression that calculates the cosine distance between two vectors.
| Parameters | |
|---|---|
| Name | Description |
vectorFieldName |
StringThe field name of the first vector. |
vector |
double[]The second vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the cosine distance. |
currentTimestamp()
public static Expression currentTimestamp()Creates an expression that returns the current timestamp.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the current timestamp. |
divide(Expression dividend, Expression divisor)
public static Expression divide(Expression dividend, Expression divisor)Creates an expression that divides two numeric expressions.
| Parameters | |
|---|---|
| Name | Description |
dividend |
ExpressionThe numeric expression to be divided. |
divisor |
ExpressionThe numeric expression to divide by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the division operation. |
divide(Expression dividend, Number divisor)
public static Expression divide(Expression dividend, Number divisor)Creates an expression that divides a numeric expression by a constant.
| Parameters | |
|---|---|
| Name | Description |
dividend |
ExpressionThe numeric expression to be divided. |
divisor |
NumberThe constant to divide by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the division operation. |
divide(String fieldName, Expression divisor)
public static Expression divide(String fieldName, Expression divisor)Creates an expression that divides numeric field by a numeric expression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe numeric field name to be divided. |
divisor |
ExpressionThe numeric expression to divide by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the divide operation. |
divide(String fieldName, Number divisor)
public static Expression divide(String fieldName, Number divisor)Creates an expression that divides a numeric field by a constant.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe numeric field name to be divided. |
divisor |
NumberThe constant to divide by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the divide operation. |
documentId(DocumentReference docRef)
public static Expression documentId(DocumentReference docRef)Creates an expression that returns the document ID from a DocumentReference.
| Parameter | |
|---|---|
| Name | Description |
docRef |
DocumentReferenceThe DocumentReference. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the documentId operation. |
documentId(Expression documentPath)
public static Expression documentId(Expression documentPath)Creates an expression that returns the document ID from a path.
| Parameter | |
|---|---|
| Name | Description |
documentPath |
ExpressionAn expression the evaluates to document path. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the documentId operation. |
documentId(String documentPath)
public static Expression documentId(String documentPath)Creates an expression that returns the document ID from a path.
| Parameter | |
|---|---|
| Name | Description |
documentPath |
StringThe string representation of the document path. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the documentId operation. |
dotProduct(Expression vector1, Expression vector2)
public static Expression dotProduct(Expression vector1, Expression vector2)Creates an expression that calculates the dot product of two vectors.
| Parameters | |
|---|---|
| Name | Description |
vector1 |
ExpressionThe first vector. |
vector2 |
ExpressionThe second vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the dot product. |
dotProduct(Expression vector1, double[] vector2)
public static Expression dotProduct(Expression vector1, double[] vector2)Creates an expression that calculates the dot product of two vectors.
| Parameters | |
|---|---|
| Name | Description |
vector1 |
ExpressionThe first vector. |
vector2 |
double[]The second vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the dot product. |
dotProduct(String vectorFieldName, Expression vector)
public static Expression dotProduct(String vectorFieldName, Expression vector)Creates an expression that calculates the dot product of two vectors.
| Parameters | |
|---|---|
| Name | Description |
vectorFieldName |
StringThe field name of the first vector. |
vector |
ExpressionThe second vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the dot product. |
dotProduct(String vectorFieldName, double[] vector)
public static Expression dotProduct(String vectorFieldName, double[] vector)Creates an expression that calculates the dot product of two vectors.
| Parameters | |
|---|---|
| Name | Description |
vectorFieldName |
StringThe field name of the first vector. |
vector |
double[]The second vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the dot product. |
endsWith(Expression string, Expression suffix)
public static BooleanExpression endsWith(Expression string, Expression suffix)Creates an expression that checks if a string expression ends with a given suffix.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression to check. |
suffix |
ExpressionThe suffix string expression to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'ends with' comparison. |
endsWith(Expression string, String suffix)
public static BooleanExpression endsWith(Expression string, String suffix)Creates an expression that checks if a string expression ends with a given suffix.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression to check. |
suffix |
StringThe suffix string to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'ends with' comparison. |
endsWith(String fieldName, Expression suffix)
public static BooleanExpression endsWith(String fieldName, Expression suffix)Creates an expression that checks if a string expression ends with a given suffix.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of field that contains a string to check. |
suffix |
ExpressionThe suffix string expression to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'ends with' comparison. |
endsWith(String fieldName, String suffix)
public static BooleanExpression endsWith(String fieldName, String suffix)Creates an expression that checks if a string expression ends with a given suffix.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of field that contains a string to check. |
suffix |
StringThe suffix string to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'ends with' comparison. |
equal(Expression left, Expression right)
public static BooleanExpression equal(Expression left, Expression right)Creates an expression that checks if two expressions are equal.
| Parameters | |
|---|---|
| Name | Description |
left |
ExpressionThe first expression. |
right |
ExpressionThe second expression. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the equality comparison. |
equal(Expression left, Object right)
public static BooleanExpression equal(Expression left, Object right)Creates an expression that checks if an expression is equal to a constant value.
| Parameters | |
|---|---|
| Name | Description |
left |
ExpressionThe expression. |
right |
ObjectThe constant value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the equality comparison. |
equal(String fieldName, Expression right)
public static BooleanExpression equal(String fieldName, Expression right)Creates an expression that checks if a field is equal to an expression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name. |
right |
ExpressionThe expression. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the equality comparison. |
equal(String fieldName, Object right)
public static BooleanExpression equal(String fieldName, Object right)Creates an expression that checks if a field is equal to a constant value.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name. |
right |
ObjectThe constant value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the equality comparison. |
equalAny(Expression expression, Expression arrayExpression)
public static BooleanExpression equalAny(Expression expression, Expression arrayExpression)Creates an expression that checks if an expression, when evaluated, is equal to any of
the elements of arrayExpression.
| Parameters | |
|---|---|
| Name | Description |
expression |
ExpressionThe expression whose results to compare. |
arrayExpression |
ExpressionAn expression that evaluates to an array, whose elements to check for equality to the input. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'IN' comparison. |
equalAny(Expression expression, List<Object> values)
public static BooleanExpression equalAny(Expression expression, List<Object> values)Creates an expression that checks if an expression, when evaluated, is equal to any of
the provided values.
| Parameters | |
|---|---|
| Name | Description |
expression |
ExpressionThe expression whose results to compare. |
values |
List<Object>The values to check against. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'IN' comparison. |
equalAny(String fieldName, Expression arrayExpression)
public static BooleanExpression equalAny(String fieldName, Expression arrayExpression)Creates an expression that checks if a field's value is equal to any of the elements of
arrayExpression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field to compare. |
arrayExpression |
ExpressionAn expression that evaluates to an array, whose elements to check for equality to the input. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'IN' comparison. |
equalAny(String fieldName, List<Object> values)
public static BooleanExpression equalAny(String fieldName, List<Object> values)Creates an expression that checks if a field's value is equal to any of the provided
values.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field to compare. |
values |
List<Object>The values to check against. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'IN' comparison. |
euclideanDistance(Expression vector1, Expression vector2)
public static Expression euclideanDistance(Expression vector1, Expression vector2)Creates an expression that calculates the Euclidean distance between two vectors.
| Parameters | |
|---|---|
| Name | Description |
vector1 |
ExpressionThe first vector. |
vector2 |
ExpressionThe second vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the Euclidean distance. |
euclideanDistance(Expression vector1, double[] vector2)
public static Expression euclideanDistance(Expression vector1, double[] vector2)Creates an expression that calculates the Euclidean distance between two vectors.
| Parameters | |
|---|---|
| Name | Description |
vector1 |
ExpressionThe first vector. |
vector2 |
double[]The second vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the Euclidean distance. |
euclideanDistance(String vectorFieldName, Expression vector)
public static Expression euclideanDistance(String vectorFieldName, Expression vector)Creates an expression that calculates the Euclidean distance between two vectors.
| Parameters | |
|---|---|
| Name | Description |
vectorFieldName |
StringThe field name of the first vector. |
vector |
ExpressionThe second vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the Euclidean distance. |
euclideanDistance(String vectorFieldName, double[] vector)
public static Expression euclideanDistance(String vectorFieldName, double[] vector)Creates an expression that calculates the Euclidean distance between two vectors.
| Parameters | |
|---|---|
| Name | Description |
vectorFieldName |
StringThe field name of the first vector. |
vector |
double[]The second vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the Euclidean distance. |
exists(Expression value)
public static BooleanExpression exists(Expression value)Creates an expression that checks if a field exists.
| Parameter | |
|---|---|
| Name | Description |
value |
ExpressionAn expression evaluates to the name of the field to check. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new Expression representing the exists check. |
exists(String fieldName)
public static BooleanExpression exists(String fieldName)Creates an expression that checks if a field exists.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe field name to check. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new Expression representing the exists check. |
exp(Expression numericExpr)
public static Expression exp(Expression numericExpr)Creates an expression that returns Euler's number e raised to the power of numericExpr.
| Parameter | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the exponentiation. |
exp(String numericField)
public static Expression exp(String numericField)Creates an expression that returns Euler's number e raised to the power of
numericField.
| Parameter | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the exponentiation. |
field(FieldPath fieldPath)
public static Field field(FieldPath fieldPath)Creates a Field instance representing the field at the given path.
The path can be a simple field name (e.g., "name") or a dot-separated path to a nested field (e.g., "address.city").
| Parameter | |
|---|---|
| Name | Description |
fieldPath |
FieldPathThe FieldPath to the field. |
| Returns | |
|---|---|
| Type | Description |
Field |
A new Field instance representing the specified path. |
field(String path)
public static Field field(String path)Creates a Field instance representing the field at the given path.
The path can be a simple field name (e.g., "name") or a dot-separated path to a nested field (e.g., "address.city").
| Parameter | |
|---|---|
| Name | Description |
path |
StringThe path to the field. |
| Returns | |
|---|---|
| Type | Description |
Field |
A new Field instance representing the specified path. |
floor(Expression numericExpr)
public static Expression floor(Expression numericExpr)Creates an expression that returns the largest integer that isn't less than
numericExpr.
| Parameter | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing an integer result from the floor operation. |
floor(String numericField)
public static Expression floor(String numericField)Creates an expression that returns the largest integer that isn't less than
numericField.
| Parameter | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing an integer result from the floor operation. |
greaterThan(Expression left, Expression right)
public static BooleanExpression greaterThan(Expression left, Expression right)Creates an expression that checks if the first expression is greater than the second expression.
| Parameters | |
|---|---|
| Name | Description |
left |
ExpressionThe first expression. |
right |
ExpressionThe second expression. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the greater than comparison. |
greaterThan(Expression left, Object right)
public static BooleanExpression greaterThan(Expression left, Object right)Creates an expression that checks if an expression is greater than a constant value.
| Parameters | |
|---|---|
| Name | Description |
left |
ExpressionThe expression. |
right |
ObjectThe constant value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the greater than comparison. |
greaterThan(String fieldName, Expression right)
public static BooleanExpression greaterThan(String fieldName, Expression right)Creates an expression that checks if a field is greater than an expression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name. |
right |
ExpressionThe expression. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the greater than comparison. |
greaterThan(String fieldName, Object right)
public static BooleanExpression greaterThan(String fieldName, Object right)Creates an expression that checks if a field is greater than a constant value.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name. |
right |
ObjectThe constant value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the greater than comparison. |
greaterThanOrEqual(Expression left, Expression right)
public static BooleanExpression greaterThanOrEqual(Expression left, Expression right)Creates an expression that checks if the first expression is greater than or equal to the second expression.
| Parameters | |
|---|---|
| Name | Description |
left |
ExpressionThe first expression. |
right |
ExpressionThe second expression. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the greater than or equal to comparison. |
greaterThanOrEqual(Expression left, Object right)
public static BooleanExpression greaterThanOrEqual(Expression left, Object right)Creates an expression that checks if an expression is greater than or equal to a constant value.
| Parameters | |
|---|---|
| Name | Description |
left |
ExpressionThe expression. |
right |
ObjectThe constant value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the greater than or equal to comparison. |
greaterThanOrEqual(String fieldName, Expression right)
public static BooleanExpression greaterThanOrEqual(String fieldName, Expression right)Creates an expression that checks if a field is greater than or equal to an expression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name. |
right |
ExpressionThe expression. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the greater than or equal to comparison. |
greaterThanOrEqual(String fieldName, Object right)
public static BooleanExpression greaterThanOrEqual(String fieldName, Object right)Creates an expression that checks if a field is greater than or equal to a constant value.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name. |
right |
ObjectThe constant value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the greater than or equal to comparison. |
ifAbsent(Expression ifExpr, Expression elseExpr)
public static Expression ifAbsent(Expression ifExpr, Expression elseExpr)Creates an expression that returns a default value if an expression evaluates to an absent value.
| Parameters | |
|---|---|
| Name | Description |
ifExpr |
ExpressionThe expression to check. |
elseExpr |
ExpressionThe default value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the ifAbsent operation. |
ifAbsent(Expression ifExpr, Object elseValue)
public static Expression ifAbsent(Expression ifExpr, Object elseValue)Creates an expression that returns a default value if an expression evaluates to an absent value.
| Parameters | |
|---|---|
| Name | Description |
ifExpr |
ExpressionThe expression to check. |
elseValue |
ObjectThe default value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the ifAbsent operation. |
ifAbsent(String ifFieldName, Expression elseExpr)
public static Expression ifAbsent(String ifFieldName, Expression elseExpr)Creates an expression that returns a default value if a field is absent.
| Parameters | |
|---|---|
| Name | Description |
ifFieldName |
StringThe field to check. |
elseExpr |
ExpressionThe default value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the ifAbsent operation. |
ifAbsent(String ifFieldName, Object elseValue)
public static Expression ifAbsent(String ifFieldName, Object elseValue)Creates an expression that returns a default value if a field is absent.
| Parameters | |
|---|---|
| Name | Description |
ifFieldName |
StringThe field to check. |
elseValue |
ObjectThe default value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the ifAbsent operation. |
ifError(BooleanExpression tryExpr, BooleanExpression catchExpr)
public static BooleanExpression ifError(BooleanExpression tryExpr, BooleanExpression catchExpr)Creates an expression that returns the catchExpr argument if there is an error, else
return the result of the tryExpr argument evaluation.
This overload will return BooleanExpression when both parameters are also BooleanExpression.
| Parameters | |
|---|---|
| Name | Description |
tryExpr |
BooleanExpressionThe try boolean expression. |
catchExpr |
BooleanExpressionThe catch boolean expression that will be evaluated and returned if the |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the ifError operation. |
ifError(Expression tryExpr, Expression catchExpr)
public static Expression ifError(Expression tryExpr, Expression catchExpr)Creates an expression that returns the catchExpr argument if there is an error, else
return the result of the tryExpr argument evaluation.
| Parameters | |
|---|---|
| Name | Description |
tryExpr |
ExpressionThe try expression. |
catchExpr |
ExpressionThe catch expression that will be evaluated and returned if the |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the ifError operation. |
ifError(Expression tryExpr, Object catchValue)
public static Expression ifError(Expression tryExpr, Object catchValue)Creates an expression that returns the catchValue argument if there is an error, else
return the result of the tryExpr argument evaluation.
| Parameters | |
|---|---|
| Name | Description |
tryExpr |
ExpressionThe try expression. |
catchValue |
ObjectThe value that will be returned if the |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the ifError operation. |
isAbsent(Expression value)
public static BooleanExpression isAbsent(Expression value)Creates an expression that returns true if a value is absent. Otherwise, returns false even if the value is null.
| Parameter | |
|---|---|
| Name | Description |
value |
ExpressionThe expression to check. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the isAbsent operation. |
isAbsent(String fieldName)
public static BooleanExpression isAbsent(String fieldName)Creates an expression that returns true if a field is absent. Otherwise, returns false even if the field value is null.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe field to check. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the isAbsent operation. |
isError(Expression expr)
public static BooleanExpression isError(Expression expr)Creates an expression that checks if a given expression produces an error.
| Parameter | |
|---|---|
| Name | Description |
expr |
ExpressionThe expression to check. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the |
isNotNaN(Expression expr)
public static BooleanExpression isNotNaN(Expression expr)Creates an expression that checks if the results of expr is NOT 'NaN' (Not a Number).
| Parameter | |
|---|---|
| Name | Description |
expr |
ExpressionThe expression to check. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the isNotNan operation. |
isNotNaN(String fieldName)
public static BooleanExpression isNotNaN(String fieldName)Creates an expression that checks if the results of this expression is NOT 'NaN' (Not a Number).
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe field to check. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the isNotNan operation. |
join(Expression arrayExpression, Expression delimiterExpression)
public static Expression join(Expression arrayExpression, Expression delimiterExpression)Creates an expression that joins the elements of an array into a string.
| Parameters | |
|---|---|
| Name | Description |
arrayExpression |
ExpressionThe expression representing the array. |
delimiterExpression |
ExpressionThe expression representing the delimiter. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the join operation. |
join(Expression arrayExpression, String delimiter)
public static Expression join(Expression arrayExpression, String delimiter)Creates an expression that joins the elements of an array into a string.
| Parameters | |
|---|---|
| Name | Description |
arrayExpression |
ExpressionThe expression representing the array. |
delimiter |
StringThe delimiter to use. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the join operation. |
join(String arrayFieldName, Expression delimiterExpression)
public static Expression join(String arrayFieldName, Expression delimiterExpression)Creates an expression that joins the elements of an array into a string.
| Parameters | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array. |
delimiterExpression |
ExpressionThe expression representing the delimiter. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the join operation. |
join(String arrayFieldName, String delimiter)
public static Expression join(String arrayFieldName, String delimiter)Creates an expression that joins the elements of an array into a string.
| Parameters | |
|---|---|
| Name | Description |
arrayFieldName |
StringThe field name of the array. |
delimiter |
StringThe delimiter to use. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the join operation. |
length(Expression string)
public static Expression length(Expression string)Creates an expression that calculates the length of string, array, map, vector, or Blob.
| Parameter | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the value to calculate the length of. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the length of the value. |
length(String fieldName)
public static Expression length(String fieldName)Creates an expression that calculates the length of string, array, map, vector, or Blob.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the length of the value. |
lessThan(Expression left, Expression right)
public static BooleanExpression lessThan(Expression left, Expression right)Creates an expression that checks if the first expression is less than the second expression.
| Parameters | |
|---|---|
| Name | Description |
left |
ExpressionThe first expression. |
right |
ExpressionThe second expression. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the less than comparison. |
lessThan(Expression left, Object right)
public static BooleanExpression lessThan(Expression left, Object right)Creates an expression that checks if an expression is less than a constant value.
| Parameters | |
|---|---|
| Name | Description |
left |
ExpressionThe expression. |
right |
ObjectThe constant value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the less than comparison. |
lessThan(String fieldName, Expression right)
public static BooleanExpression lessThan(String fieldName, Expression right)Creates an expression that checks if a field is less than an expression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name. |
right |
ExpressionThe expression. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the less than comparison. |
lessThan(String fieldName, Object right)
public static BooleanExpression lessThan(String fieldName, Object right)Creates an expression that checks if a field is less than a constant value.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name. |
right |
ObjectThe constant value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the less than comparison. |
lessThanOrEqual(Expression left, Expression right)
public static BooleanExpression lessThanOrEqual(Expression left, Expression right)Creates an expression that checks if the first expression is less than or equal to the second expression.
| Parameters | |
|---|---|
| Name | Description |
left |
ExpressionThe first expression. |
right |
ExpressionThe second expression. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the less than or equal to comparison. |
lessThanOrEqual(Expression left, Object right)
public static BooleanExpression lessThanOrEqual(Expression left, Object right)Creates an expression that checks if an expression is less than or equal to a constant value.
| Parameters | |
|---|---|
| Name | Description |
left |
ExpressionThe expression. |
right |
ObjectThe constant value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the less than or equal to comparison. |
lessThanOrEqual(String fieldName, Expression right)
public static BooleanExpression lessThanOrEqual(String fieldName, Expression right)Creates an expression that checks if a field is less than or equal to an expression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name. |
right |
ExpressionThe expression. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the less than or equal to comparison. |
lessThanOrEqual(String fieldName, Object right)
public static BooleanExpression lessThanOrEqual(String fieldName, Object right)Creates an expression that checks if a field is less than or equal to a constant value.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name. |
right |
ObjectThe constant value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the less than or equal to comparison. |
like(Expression string, Expression pattern)
public static BooleanExpression like(Expression string, Expression pattern)Creates an expression that performs a case-sensitive wildcard string comparison.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string to perform the comparison on. |
pattern |
ExpressionThe pattern to search for. You can use "%" as a wildcard character. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the like operation. |
like(Expression string, String pattern)
public static BooleanExpression like(Expression string, String pattern)Creates an expression that performs a case-sensitive wildcard string comparison.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string to perform the comparison on. |
pattern |
StringThe pattern to search for. You can use "%" as a wildcard character. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the like operation. |
like(String fieldName, Expression pattern)
public static BooleanExpression like(String fieldName, Expression pattern)Creates an expression that performs a case-sensitive wildcard string comparison against a field.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string. |
pattern |
ExpressionThe pattern to search for. You can use "%" as a wildcard character. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the like comparison. |
like(String fieldName, String pattern)
public static BooleanExpression like(String fieldName, String pattern)Creates an expression that performs a case-sensitive wildcard string comparison against a field.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string. |
pattern |
StringThe pattern to search for. You can use "%" as a wildcard character. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the like comparison. |
ln(Expression numericExpr)
public static Expression ln(Expression numericExpr)Creates an expression that returns the natural logarithm (base e) of numericExpr.
| Parameter | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the natural logarithm. |
ln(String numericField)
public static Expression ln(String numericField)Creates an expression that returns the natural logarithm (base e) of numericField.
| Parameter | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the natural logarithm. |
log(Expression numericExpr, Expression base)
public static Expression log(Expression numericExpr, Expression base)Creates an expression that returns the logarithm of numericExpr with a given
base.
| Parameters | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
base |
ExpressionThe base of the logarithm. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing a numeric result from the logarithm of |
log(Expression numericExpr, Number base)
public static Expression log(Expression numericExpr, Number base)Creates an expression that returns the logarithm of numericExpr with a given
base.
| Parameters | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
base |
NumberThe base of the logarithm. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing a numeric result from the logarithm of |
log(String numericField, Expression base)
public static Expression log(String numericField, Expression base)Creates an expression that returns the logarithm of numericField with a given
base.
| Parameters | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
base |
ExpressionThe base of the logarithm. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing a numeric result from the logarithm of |
log(String numericField, Number base)
public static Expression log(String numericField, Number base)Creates an expression that returns the logarithm of numericField with a given
base.
| Parameters | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
base |
NumberThe base of the logarithm. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing a numeric result from the logarithm of |
log10(Expression numericExpr)
public static Expression log10(Expression numericExpr)Creates an expression that returns the base 10 logarithm of numericExpr.
| Parameter | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the base 10 logarithm. |
log10(String numericField)
public static Expression log10(String numericField)Creates an expression that returns the base 10 logarithm of numericField.
| Parameter | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the base 10 logarithm. |
logicalMaximum(Expression expr, Object[] others)
public static Expression logicalMaximum(Expression expr, Object[] others)Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering.
| Parameters | |
|---|---|
| Name | Description |
expr |
ExpressionThe first operand expression. |
others |
Object[]Optional additional expressions or literals. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the logical maximum operation. |
logicalMaximum(String fieldName, Object[] others)
public static Expression logicalMaximum(String fieldName, Object[] others)Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe first operand field name. |
others |
Object[]Optional additional expressions or literals. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the logical maximum operation. |
logicalMinimum(Expression expr, Object[] others)
public static Expression logicalMinimum(Expression expr, Object[] others)Creates an expression that returns the smallest value between multiple input expressions or literal values. Based on Firestore's value type ordering.
| Parameters | |
|---|---|
| Name | Description |
expr |
ExpressionThe first operand expression. |
others |
Object[]Optional additional expressions or literals. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the logical minimum operation. |
logicalMinimum(String fieldName, Object[] others)
public static Expression logicalMinimum(String fieldName, Object[] others)Creates an expression that returns the smallest value between multiple input expressions or literal values. Based on Firestore's value type ordering.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe first operand field name. |
others |
Object[]Optional additional expressions or literals. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the logical minimum operation. |
map(Map<String,Object> elements)
public static Expression map(Map<String,Object> elements)Creates an expression that creates a Firestore map value from an input object.
| Parameter | |
|---|---|
| Name | Description |
elements |
Map<String,Object>The input map to evaluate in the expression. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the map function. |
mapGet(Expression map, Expression key)
public static Expression mapGet(Expression map, Expression key)Accesses a value from a map (object) field using the provided keyExpression.
| Parameters | |
|---|---|
| Name | Description |
map |
ExpressionThe expression representing the map. |
key |
ExpressionThe key to access in the map. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the value associated with the given key in the map. |
mapGet(Expression map, String key)
public static Expression mapGet(Expression map, String key)Accesses a value from a map (object) field using the provided key.
| Parameters | |
|---|---|
| Name | Description |
map |
ExpressionThe expression representing the map. |
key |
StringThe key to access in the map. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the value associated with the given key in the map. |
mapGet(String fieldName, Expression key)
public static Expression mapGet(String fieldName, Expression key)Accesses a value from a map (object) field using the provided keyExpression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name of the map field. |
key |
ExpressionThe key to access in the map. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the value associated with the given key in the map. |
mapGet(String fieldName, String key)
public static Expression mapGet(String fieldName, String key)Accesses a value from a map (object) field using the provided key.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name of the map field. |
key |
StringThe key to access in the map. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the value associated with the given key in the map. |
mapMerge(Expression firstMap, Expression secondMap)
public static Expression mapMerge(Expression firstMap, Expression secondMap)| Parameters | |
|---|---|
| Name | Description |
firstMap |
Expression |
secondMap |
Expression |
| Returns | |
|---|---|
| Type | Description |
Expression |
|
mapMerge(Expression firstMap, Expression secondMap, Expression[] otherMaps)
public static Expression mapMerge(Expression firstMap, Expression secondMap, Expression[] otherMaps)Creates an expression that merges multiple maps into a single map. If multiple maps have the same key, the later value is used.
| Parameters | |
|---|---|
| Name | Description |
firstMap |
ExpressionFirst map expression that will be merged. |
secondMap |
ExpressionSecond map expression that will be merged. |
otherMaps |
Expression[]Additional maps to merge. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the mapMerge operation. |
mapMerge(String firstMapFieldName, Expression secondMap)
public static Expression mapMerge(String firstMapFieldName, Expression secondMap)| Parameters | |
|---|---|
| Name | Description |
firstMapFieldName |
String |
secondMap |
Expression |
| Returns | |
|---|---|
| Type | Description |
Expression |
|
mapMerge(String firstMapFieldName, Expression secondMap, Expression[] otherMaps)
public static Expression mapMerge(String firstMapFieldName, Expression secondMap, Expression[] otherMaps)Creates an expression that merges multiple maps into a single map. If multiple maps have the same key, the later value is used.
| Parameters | |
|---|---|
| Name | Description |
firstMapFieldName |
StringField name of the first map expression that will be merged. |
secondMap |
ExpressionSecond map expression that will be merged. |
otherMaps |
Expression[]Additional maps to merge. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the mapMerge operation. |
mapRemove(Expression mapExpr, Expression key)
public static Expression mapRemove(Expression mapExpr, Expression key)Creates an expression that removes a key from a map.
| Parameters | |
|---|---|
| Name | Description |
mapExpr |
ExpressionThe expression representing the map. |
key |
ExpressionThe key to remove from the map. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the map with the key removed. |
mapRemove(Expression mapExpr, String key)
public static Expression mapRemove(Expression mapExpr, String key)Creates an expression that removes a key from a map.
| Parameters | |
|---|---|
| Name | Description |
mapExpr |
ExpressionThe expression representing the map. |
key |
StringThe key to remove from the map. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the map with the key removed. |
mapRemove(String mapField, Expression key)
public static Expression mapRemove(String mapField, Expression key)Creates an expression that removes a key from a map.
| Parameters | |
|---|---|
| Name | Description |
mapField |
StringThe field name of the map. |
key |
ExpressionThe key to remove from the map. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the map with the key removed. |
mapRemove(String mapField, String key)
public static Expression mapRemove(String mapField, String key)Creates an expression that removes a key from a map.
| Parameters | |
|---|---|
| Name | Description |
mapField |
StringThe field name of the map. |
key |
StringThe key to remove from the map. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the map with the key removed. |
mod(Expression dividend, Expression divisor)
public static Expression mod(Expression dividend, Expression divisor)Creates an expression that calculates the modulo (remainder) of dividing two numeric expressions.
| Parameters | |
|---|---|
| Name | Description |
dividend |
ExpressionThe numeric expression to be divided. |
divisor |
ExpressionThe numeric expression to divide by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the modulo operation. |
mod(Expression dividend, Number divisor)
public static Expression mod(Expression dividend, Number divisor)Creates an expression that calculates the modulo (remainder) of dividing a numeric expression by a constant.
| Parameters | |
|---|---|
| Name | Description |
dividend |
ExpressionThe numeric expression to be divided. |
divisor |
NumberThe constant to divide by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the modulo operation. |
mod(String fieldName, Expression divisor)
public static Expression mod(String fieldName, Expression divisor)Creates an expression that calculates the modulo (remainder) of dividing a numeric field by a constant.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe numeric field name to be divided. |
divisor |
ExpressionThe numeric expression to divide by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the modulo operation. |
mod(String fieldName, Number divisor)
public static Expression mod(String fieldName, Number divisor)Creates an expression that calculates the modulo (remainder) of dividing a numeric field by a constant.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe numeric field name to be divided. |
divisor |
NumberThe constant to divide by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the modulo operation. |
multiply(Expression first, Expression second)
public static Expression multiply(Expression first, Expression second)Creates an expression that multiplies numeric expressions.
| Parameters | |
|---|---|
| Name | Description |
first |
ExpressionNumeric expression to multiply. |
second |
ExpressionNumeric expression to multiply. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the multiplication operation. |
multiply(Expression first, Number second)
public static Expression multiply(Expression first, Number second)Creates an expression that multiplies numeric expressions with a constant.
| Parameters | |
|---|---|
| Name | Description |
first |
ExpressionNumeric expression to multiply. |
second |
NumberConstant to multiply. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the multiplication operation. |
multiply(String fieldName, Expression second)
public static Expression multiply(String fieldName, Expression second)Creates an expression that multiplies a numeric field with a numeric expression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringNumeric field to multiply. |
second |
ExpressionNumeric expression to multiply. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the multiplication operation. |
multiply(String fieldName, Number second)
public static Expression multiply(String fieldName, Number second)Creates an expression that multiplies a numeric field with a constant.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringNumeric field to multiply. |
second |
NumberConstant to multiply. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the multiplication operation. |
not(BooleanExpression condition)
public static BooleanExpression not(BooleanExpression condition)Creates an expression that negates a boolean expression.
| Parameter | |
|---|---|
| Name | Description |
condition |
BooleanExpressionThe boolean expression to negate. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the not operation. |
notEqual(Expression left, Expression right)
public static BooleanExpression notEqual(Expression left, Expression right)Creates an expression that checks if two expressions are not equal.
| Parameters | |
|---|---|
| Name | Description |
left |
ExpressionThe first expression. |
right |
ExpressionThe second expression. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the inequality comparison. |
notEqual(Expression left, Object right)
public static BooleanExpression notEqual(Expression left, Object right)Creates an expression that checks if an expression is not equal to a constant value.
| Parameters | |
|---|---|
| Name | Description |
left |
ExpressionThe expression. |
right |
ObjectThe constant value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the inequality comparison. |
notEqual(String fieldName, Expression right)
public static BooleanExpression notEqual(String fieldName, Expression right)Creates an expression that checks if a field is not equal to an expression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name. |
right |
ExpressionThe expression. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the inequality comparison. |
notEqual(String fieldName, Object right)
public static BooleanExpression notEqual(String fieldName, Object right)Creates an expression that checks if a field is not equal to a constant value.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name. |
right |
ObjectThe constant value. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the inequality comparison. |
notEqualAny(Expression expression, Expression arrayExpression)
public static BooleanExpression notEqualAny(Expression expression, Expression arrayExpression)Creates an expression that checks if an expression, when evaluated, is not equal to all
the elements of arrayExpression.
| Parameters | |
|---|---|
| Name | Description |
expression |
ExpressionThe expression whose results to compare. |
arrayExpression |
ExpressionAn expression that evaluates to an array, whose elements to check for equality to the input. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'NOT IN' comparison. |
notEqualAny(Expression expression, List<Object> values)
public static BooleanExpression notEqualAny(Expression expression, List<Object> values)Creates an expression that checks if an expression, when evaluated, is not equal to all
the provided values.
| Parameters | |
|---|---|
| Name | Description |
expression |
ExpressionThe expression whose results to compare. |
values |
List<Object>The values to check against. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'NOT IN' comparison. |
notEqualAny(String fieldName, Expression arrayExpression)
public static BooleanExpression notEqualAny(String fieldName, Expression arrayExpression)Creates an expression that checks if a field's value is not equal to all of the elements of
arrayExpression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field to compare. |
arrayExpression |
ExpressionAn expression that evaluates to an array, whose elements to check for equality to the input. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'NOT IN' comparison. |
notEqualAny(String fieldName, List<Object> values)
public static BooleanExpression notEqualAny(String fieldName, List<Object> values)Creates an expression that checks if a field's value is not equal to all of the provided
values.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field to compare. |
values |
List<Object>The values to check against. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'NOT IN' comparison. |
nullValue()
public static Expression nullValue()Constant for a null value.
| Returns | |
|---|---|
| Type | Description |
Expression |
An Expression constant instance. |
or(BooleanExpression condition, BooleanExpression[] conditions)
public static BooleanExpression or(BooleanExpression condition, BooleanExpression[] conditions)Creates an expression that performs a logical 'OR' operation.
| Parameters | |
|---|---|
| Name | Description |
condition |
BooleanExpressionThe first BooleanExpression. |
conditions |
BooleanExpression[]Additional BooleanExpressions. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the logical 'OR' operation. |
pow(Expression numericExpr, Expression exponent)
public static Expression pow(Expression numericExpr, Expression exponent)Creates an expression that returns the numericExpr raised to the power of the
exponent. Returns infinity on overflow and zero on underflow.
| Parameters | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
exponent |
ExpressionThe numeric power to raise the |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing a numeric result from raising |
pow(Expression numericExpr, Number exponent)
public static Expression pow(Expression numericExpr, Number exponent)Creates an expression that returns the numericExpr raised to the power of the
exponent. Returns infinity on overflow and zero on underflow.
| Parameters | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
exponent |
NumberThe numeric power to raise the |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing a numeric result from raising |
pow(String numericField, Expression exponent)
public static Expression pow(String numericField, Expression exponent)Creates an expression that returns the numericField raised to the power of the
exponent. Returns infinity on overflow and zero on underflow.
| Parameters | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
exponent |
ExpressionThe numeric power to raise the |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing a numeric result from raising |
pow(String numericField, Number exponent)
public static Expression pow(String numericField, Number exponent)Creates an expression that returns the numericField raised to the power of the
exponent. Returns infinity on overflow and zero on underflow.
| Parameters | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
exponent |
NumberThe numeric power to raise the |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing a numeric result from raising |
rawExpression(String name, Expression[] expr)
public static Expression rawExpression(String name, Expression[] expr)Creates a generic function expression that is not yet implemented.
| Parameters | |
|---|---|
| Name | Description |
name |
StringThe name of the generic function. |
expr |
Expression[]The expressions to be passed as arguments to the function. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the generic function. |
regexContains(Expression string, Expression pattern)
public static BooleanExpression regexContains(Expression string, Expression pattern)Creates an expression that checks if a string expression contains a specified regular expression as a substring.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string to perform the comparison on. |
pattern |
ExpressionThe regular expression to use for the search. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the contains regular expression comparison. |
regexContains(Expression string, String pattern)
public static BooleanExpression regexContains(Expression string, String pattern)Creates an expression that checks if a string expression contains a specified regular expression as a substring.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string to perform the comparison on. |
pattern |
StringThe regular expression to use for the search. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the contains regular expression comparison. |
regexContains(String fieldName, Expression pattern)
public static BooleanExpression regexContains(String fieldName, Expression pattern)Creates an expression that checks if a string field contains a specified regular expression as a substring.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string. |
pattern |
ExpressionThe regular expression to use for the search. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the contains regular expression comparison. |
regexContains(String fieldName, String pattern)
public static BooleanExpression regexContains(String fieldName, String pattern)Creates an expression that checks if a string field contains a specified regular expression as a substring.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string. |
pattern |
StringThe regular expression to use for the search. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the contains regular expression comparison. |
regexMatch(Expression string, Expression pattern)
public static BooleanExpression regexMatch(Expression string, Expression pattern)Creates an expression that checks if a string field matches a specified regular expression.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string to match against. |
pattern |
ExpressionThe regular expression to use for the match. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the regular expression match comparison. |
regexMatch(Expression string, String pattern)
public static BooleanExpression regexMatch(Expression string, String pattern)Creates an expression that checks if a string field matches a specified regular expression.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string to match against. |
pattern |
StringThe regular expression to use for the match. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the regular expression match comparison. |
regexMatch(String fieldName, Expression pattern)
public static BooleanExpression regexMatch(String fieldName, Expression pattern)Creates an expression that checks if a string field matches a specified regular expression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string. |
pattern |
ExpressionThe regular expression to use for the match. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the regular expression match comparison. |
regexMatch(String fieldName, String pattern)
public static BooleanExpression regexMatch(String fieldName, String pattern)Creates an expression that checks if a string field matches a specified regular expression.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string. |
pattern |
StringThe regular expression to use for the match. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the regular expression match comparison. |
reverse(Expression expr)
public static Expression reverse(Expression expr)Creates an expression that reverses a string, blob, or array.
| Parameter | |
|---|---|
| Name | Description |
expr |
ExpressionAn expression evaluating to a string, blob, or array value, which will be reversed. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the reversed value. |
reverse(String fieldName)
public static Expression reverse(String fieldName)Creates an expression that reverses the field value, which must be a string, blob, or array.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringA field evaluating to a string, blob, or array value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the reversed value. |
round(Expression numericExpr)
public static Expression round(Expression numericExpr)Creates an expression that rounds numericExpr to nearest integer.
Rounds away from zero in halfway cases.
| Parameter | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing an integer result from the round operation. |
round(String numericField)
public static Expression round(String numericField)Creates an expression that rounds numericField to nearest integer.
Rounds away from zero in halfway cases.
| Parameter | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing an integer result from the round operation. |
roundToPrecision(Expression numericExpr, Expression decimalPlace)
public static Expression roundToPrecision(Expression numericExpr, Expression decimalPlace)Creates an expression that rounds off numericExpr to decimalPlace decimal
places if decimalPlace is positive, rounds off digits to the left of the decimal point
if decimalPlace is negative. Rounds away from zero in halfway cases.
| Parameters | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
decimalPlace |
ExpressionThe number of decimal places to round. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the round operation. |
roundToPrecision(Expression numericExpr, int decimalPlace)
public static Expression roundToPrecision(Expression numericExpr, int decimalPlace)Creates an expression that rounds off numericExpr to decimalPlace decimal
places if decimalPlace is positive, rounds off digits to the left of the decimal point
if decimalPlace is negative. Rounds away from zero in halfway cases.
| Parameters | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
decimalPlace |
intThe number of decimal places to round. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the round operation. |
roundToPrecision(String numericField, Expression decimalPlace)
public static Expression roundToPrecision(String numericField, Expression decimalPlace)Creates an expression that rounds off numericField to decimalPlace decimal
places if decimalPlace is positive, rounds off digits to the left of the decimal point
if decimalPlace is negative. Rounds away from zero in halfway cases.
| Parameters | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
decimalPlace |
ExpressionThe number of decimal places to round. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the round operation. |
roundToPrecision(String numericField, int decimalPlace)
public static Expression roundToPrecision(String numericField, int decimalPlace)Creates an expression that rounds off numericField to decimalPlace decimal
places if decimalPlace is positive, rounds off digits to the left of the decimal point
if decimalPlace is negative. Rounds away from zero in halfway cases.
| Parameters | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
decimalPlace |
intThe number of decimal places to round. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the round operation. |
split(Expression value, Expression delimiter)
public static Expression split(Expression value, Expression delimiter)Creates an expression that splits a string or blob by a delimiter.
| Parameters | |
|---|---|
| Name | Description |
value |
ExpressionThe expression representing the string or blob to split. |
delimiter |
ExpressionThe delimiter to split by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the split string or blob as an array. |
split(Expression value, String delimiter)
public static Expression split(Expression value, String delimiter)Creates an expression that splits a string or blob by a delimiter.
| Parameters | |
|---|---|
| Name | Description |
value |
ExpressionThe expression representing the string or blob to split. |
delimiter |
StringThe delimiter to split by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the split string or blob as an array. |
split(String fieldName, Expression delimiter)
public static Expression split(String fieldName, Expression delimiter)Creates an expression that splits a string or blob by a delimiter.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string or blob to split. |
delimiter |
ExpressionThe delimiter to split by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the split string or blob as an array. |
split(String fieldName, String delimiter)
public static Expression split(String fieldName, String delimiter)Creates an expression that splits a string or blob by a delimiter.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string or blob to split. |
delimiter |
StringThe delimiter to split by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the split string or blob as an array. |
sqrt(Expression numericExpr)
public static Expression sqrt(Expression numericExpr)Creates an expression that returns the square root of numericExpr.
| Parameter | |
|---|---|
| Name | Description |
numericExpr |
ExpressionAn expression that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the square root operation. |
sqrt(String numericField)
public static Expression sqrt(String numericField)Creates an expression that returns the square root of numericField.
| Parameter | |
|---|---|
| Name | Description |
numericField |
StringName of field that returns number when evaluated. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the square root operation. |
startsWith(Expression string, Expression prefix)
public static BooleanExpression startsWith(Expression string, Expression prefix)Creates an expression that checks if a string expression starts with a given prefix.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression to check. |
prefix |
ExpressionThe prefix string expression to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'starts with' comparison. |
startsWith(Expression string, String prefix)
public static BooleanExpression startsWith(Expression string, String prefix)Creates an expression that checks if a string expression starts with a given prefix.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression to check. |
prefix |
StringThe prefix string to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'starts with' comparison. |
startsWith(String fieldName, Expression prefix)
public static BooleanExpression startsWith(String fieldName, Expression prefix)Creates an expression that checks if a string expression starts with a given prefix.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of field that contains a string to check. |
prefix |
ExpressionThe prefix string expression to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'starts with' comparison. |
startsWith(String fieldName, String prefix)
public static BooleanExpression startsWith(String fieldName, String prefix)Creates an expression that checks if a string expression starts with a given prefix.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of field that contains a string to check. |
prefix |
StringThe prefix string to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'starts with' comparison. |
stringConcat(Expression firstString, Object[] otherStrings)
public static Expression stringConcat(Expression firstString, Object[] otherStrings)Creates an expression that concatenates string expressions together.
| Parameters | |
|---|---|
| Name | Description |
firstString |
ExpressionThe expression representing the initial string value. |
otherStrings |
Object[]Optional additional string expressions or string constants to concatenate. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the concatenated string. |
stringConcat(String fieldName, Object[] otherStrings)
public static Expression stringConcat(String fieldName, Object[] otherStrings)Creates an expression that concatenates string expressions together.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe field name containing the initial string value. |
otherStrings |
Object[]Optional additional string expressions or string constants to concatenate. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the concatenated string. |
stringContains(Expression string, Expression substring)
public static BooleanExpression stringContains(Expression string, Expression substring)Creates an expression that checks if a string expression contains a specified substring.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string to perform the comparison on. |
substring |
ExpressionThe expression representing the substring to search for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the contains comparison. |
stringContains(Expression string, String substring)
public static BooleanExpression stringContains(Expression string, String substring)Creates an expression that checks if a string expression contains a specified substring.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string to perform the comparison on. |
substring |
StringThe substring to search for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the contains comparison. |
stringContains(String fieldName, Expression substring)
public static BooleanExpression stringContains(String fieldName, Expression substring)Creates an expression that checks if a string field contains a specified substring.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field to perform the comparison on. |
substring |
ExpressionThe expression representing the substring to search for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the contains comparison. |
stringContains(String fieldName, String substring)
public static BooleanExpression stringContains(String fieldName, String substring)Creates an expression that checks if a string field contains a specified substring.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field to perform the comparison on. |
substring |
StringThe substring to search for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the contains comparison. |
substring(Expression string, Expression index, Expression length)
public static Expression substring(Expression string, Expression index, Expression length)Creates an expression that returns a substring of the given string.
| Parameters | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string to get a substring from. |
index |
ExpressionThe starting index of the substring. |
length |
ExpressionThe length of the substring. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the substring. |
substring(String fieldName, int index, int length)
public static Expression substring(String fieldName, int index, int length)Creates an expression that returns a substring of the given string.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string to get a substring from. |
index |
intThe starting index of the substring. |
length |
intThe length of the substring. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the substring. |
subtract(Expression minuend, Expression subtrahend)
public static Expression subtract(Expression minuend, Expression subtrahend)Creates an expression that subtracts two expressions.
| Parameters | |
|---|---|
| Name | Description |
minuend |
ExpressionNumeric expression to subtract from. |
subtrahend |
ExpressionNumeric expression to subtract. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the subtract operation. |
subtract(Expression minuend, Number subtrahend)
public static Expression subtract(Expression minuend, Number subtrahend)Creates an expression that subtracts a constant value from a numeric expression.
| Parameters | |
|---|---|
| Name | Description |
minuend |
ExpressionNumeric expression to subtract from. |
subtrahend |
NumberConstant to subtract. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the subtract operation. |
subtract(String fieldName, Expression subtrahend)
public static Expression subtract(String fieldName, Expression subtrahend)Creates an expression that subtracts a numeric expressions from numeric field.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringNumeric field to subtract from. |
subtrahend |
ExpressionNumeric expression to subtract. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the subtract operation. |
subtract(String fieldName, Number subtrahend)
public static Expression subtract(String fieldName, Number subtrahend)Creates an expression that subtracts a constant from numeric field.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringNumeric field to subtract from. |
subtrahend |
NumberConstant to subtract. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the subtract operation. |
timestampAdd(Expression timestamp, Expression unit, Expression amount)
public static Expression timestampAdd(Expression timestamp, Expression unit, Expression amount)Creates an expression that adds a specified amount of time to a timestamp.
| Parameters | |
|---|---|
| Name | Description |
timestamp |
ExpressionThe expression representing the timestamp. |
unit |
ExpressionThe expression representing the unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
amount |
ExpressionThe expression representing the amount of time to add. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the resulting timestamp. |
timestampAdd(Expression timestamp, String unit, long amount)
public static Expression timestampAdd(Expression timestamp, String unit, long amount)Creates an expression that adds a specified amount of time to a timestamp.
| Parameters | |
|---|---|
| Name | Description |
timestamp |
ExpressionThe expression representing the timestamp. |
unit |
StringThe unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
amount |
longThe amount of time to add. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the resulting timestamp. |
timestampAdd(String fieldName, Expression unit, Expression amount)
public static Expression timestampAdd(String fieldName, Expression unit, Expression amount)Creates an expression that adds a specified amount of time to a timestamp.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field that contains the timestamp. |
unit |
ExpressionThe expression representing the unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
amount |
ExpressionThe expression representing the amount of time to add. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the resulting timestamp. |
timestampAdd(String fieldName, String unit, long amount)
public static Expression timestampAdd(String fieldName, String unit, long amount)Creates an expression that adds a specified amount of time to a timestamp.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field that contains the timestamp. |
unit |
StringThe unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
amount |
longThe amount of time to add. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the resulting timestamp. |
timestampSubtract(Expression timestamp, Expression unit, Expression amount)
public static Expression timestampSubtract(Expression timestamp, Expression unit, Expression amount)Creates an expression that subtracts a specified amount of time to a timestamp.
| Parameters | |
|---|---|
| Name | Description |
timestamp |
ExpressionThe expression representing the timestamp. |
unit |
ExpressionThe expression representing the unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
amount |
ExpressionThe expression representing the amount of time to subtract. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the resulting timestamp. |
timestampSubtract(Expression timestamp, String unit, long amount)
public static Expression timestampSubtract(Expression timestamp, String unit, long amount)Creates an expression that subtracts a specified amount of time to a timestamp.
| Parameters | |
|---|---|
| Name | Description |
timestamp |
ExpressionThe expression representing the timestamp. |
unit |
StringThe unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
amount |
longThe amount of time to subtract. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the resulting timestamp. |
timestampSubtract(String fieldName, Expression unit, Expression amount)
public static Expression timestampSubtract(String fieldName, Expression unit, Expression amount)Creates an expression that subtracts a specified amount of time to a timestamp.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field that contains the timestamp. |
unit |
ExpressionThe unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
amount |
ExpressionThe amount of time to subtract. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the resulting timestamp. |
timestampSubtract(String fieldName, String unit, long amount)
public static Expression timestampSubtract(String fieldName, String unit, long amount)Creates an expression that subtracts a specified amount of time to a timestamp.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field that contains the timestamp. |
unit |
StringThe unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
amount |
longThe amount of time to subtract. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the resulting timestamp. |
timestampToUnixMicros(Expression expr)
public static Expression timestampToUnixMicros(Expression expr)Creates an expression that converts a timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
| Parameter | |
|---|---|
| Name | Description |
expr |
ExpressionThe expression representing the timestamp. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the number of microseconds since epoch. |
timestampToUnixMicros(String fieldName)
public static Expression timestampToUnixMicros(String fieldName)Creates an expression that converts a timestamp field to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field that contains the timestamp. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the number of microseconds since epoch. |
timestampToUnixMillis(Expression expr)
public static Expression timestampToUnixMillis(Expression expr)Creates an expression that converts a timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
| Parameter | |
|---|---|
| Name | Description |
expr |
ExpressionThe expression representing the timestamp. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the number of milliseconds since epoch. |
timestampToUnixMillis(String fieldName)
public static Expression timestampToUnixMillis(String fieldName)Creates an expression that converts a timestamp field to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field that contains the timestamp. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the number of milliseconds since epoch. |
timestampToUnixSeconds(Expression expr)
public static Expression timestampToUnixSeconds(Expression expr)Creates an expression that converts a timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC).
| Parameter | |
|---|---|
| Name | Description |
expr |
ExpressionThe expression representing the timestamp. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the number of seconds since epoch. |
timestampToUnixSeconds(String fieldName)
public static Expression timestampToUnixSeconds(String fieldName)Creates an expression that converts a timestamp field to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC).
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field that contains the timestamp. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the number of seconds since epoch. |
timestampTruncate(Expression timestamp, Expression granularity)
public static Expression timestampTruncate(Expression timestamp, Expression granularity)Creates an expression that truncates a timestamp to a specified granularity.
| Parameters | |
|---|---|
| Name | Description |
timestamp |
ExpressionThe timestamp expression. |
granularity |
ExpressionThe granularity expression to truncate to. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "day", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the truncated timestamp. |
timestampTruncate(Expression timestamp, Expression granularity, String timezone)
public static Expression timestampTruncate(Expression timestamp, Expression granularity, String timezone)Creates an expression that truncates a timestamp to a specified granularity in a given timezone.
| Parameters | |
|---|---|
| Name | Description |
timestamp |
ExpressionThe timestamp expression. |
granularity |
ExpressionThe granularity expression to truncate to. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "day", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
timezone |
StringThe timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1". |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the truncated timestamp. |
timestampTruncate(Expression timestamp, String granularity)
public static Expression timestampTruncate(Expression timestamp, String granularity)Creates an expression that truncates a timestamp to a specified granularity.
| Parameters | |
|---|---|
| Name | Description |
timestamp |
ExpressionThe timestamp expression. |
granularity |
StringThe granularity to truncate to. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "day", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the truncated timestamp. |
timestampTruncate(Expression timestamp, String granularity, String timezone)
public static Expression timestampTruncate(Expression timestamp, String granularity, String timezone)Creates an expression that truncates a timestamp to a specified granularity in a given timezone.
| Parameters | |
|---|---|
| Name | Description |
timestamp |
ExpressionThe timestamp expression. |
granularity |
StringThe granularity to truncate to. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "day", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
timezone |
StringThe timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1". |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the truncated timestamp. |
timestampTruncate(String fieldName, Expression granularity)
public static Expression timestampTruncate(String fieldName, Expression granularity)Creates an expression that truncates a timestamp to a specified granularity.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the timestamp. |
granularity |
ExpressionThe granularity expression to truncate to. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "day", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the truncated timestamp. |
timestampTruncate(String fieldName, Expression granularity, String timezone)
public static Expression timestampTruncate(String fieldName, Expression granularity, String timezone)Creates an expression that truncates a timestamp to a specified granularity in a given timezone.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the timestamp. |
granularity |
ExpressionThe granularity expression to truncate to. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "day", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
timezone |
StringThe timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1". |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the truncated timestamp. |
timestampTruncate(String fieldName, String granularity)
public static Expression timestampTruncate(String fieldName, String granularity)Creates an expression that truncates a timestamp to a specified granularity.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the timestamp. |
granularity |
StringThe granularity to truncate to. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "day", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the truncated timestamp. |
timestampTruncate(String fieldName, String granularity, String timezone)
public static Expression timestampTruncate(String fieldName, String granularity, String timezone)Creates an expression that truncates a timestamp to a specified granularity in a given timezone.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the timestamp. |
granularity |
StringThe granularity to truncate to. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "day", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
timezone |
StringThe timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1". |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the truncated timestamp. |
toLower(Expression string)
public static Expression toLower(Expression string)Creates an expression that converts a string expression to lowercase.
| Parameter | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string to convert to lowercase. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the lowercase string. |
toLower(String fieldName)
public static Expression toLower(String fieldName)Creates an expression that converts a string field to lowercase.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string to convert to lowercase. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the lowercase string. |
toUpper(Expression string)
public static Expression toUpper(Expression string)Creates an expression that converts a string expression to uppercase.
| Parameter | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string to convert to uppercase. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the lowercase string. |
toUpper(String fieldName)
public static Expression toUpper(String fieldName)Creates an expression that converts a string field to uppercase.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string to convert to uppercase. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the lowercase string. |
trim(Expression string)
public static Expression trim(Expression string)Creates an expression that removes leading and trailing whitespace from a string expression.
| Parameter | |
|---|---|
| Name | Description |
string |
ExpressionThe expression representing the string to trim. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the trimmed string. |
trim(String fieldName)
public static Expression trim(String fieldName)Creates an expression that removes leading and trailing whitespace from a string field.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string to trim. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the trimmed string. |
trimValue(Expression value, Expression characters)
public static Expression trimValue(Expression value, Expression characters)Creates an expression that removes specified characters from the beginning and end of a string or blob.
| Parameters | |
|---|---|
| Name | Description |
value |
ExpressionThe expression representing the string or blob to trim. |
characters |
ExpressionThe expression representing the characters to remove. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the trimmed string or blob. |
trimValue(Expression value, String characters)
public static Expression trimValue(Expression value, String characters)Creates an expression that removes specified characters from the beginning and end of a string or blob.
| Parameters | |
|---|---|
| Name | Description |
value |
ExpressionThe expression representing the string or blob to trim. |
characters |
StringThe characters to remove. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the trimmed string or blob. |
trimValue(String fieldName, Expression characters)
public static Expression trimValue(String fieldName, Expression characters)Creates an expression that removes specified characters from the beginning and end of a string or blob.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string or blob to trim. |
characters |
ExpressionThe expression representing the characters to remove. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the trimmed string or blob. |
trimValue(String fieldName, String characters)
public static Expression trimValue(String fieldName, String characters)Creates an expression that removes specified characters from the beginning and end of a string or blob.
| Parameters | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the string or blob to trim. |
characters |
StringThe characters to remove. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the trimmed string or blob. |
type(Expression expr)
public static Expression type(Expression expr)Creates an expression that returns a string indicating the type of the value this expression evaluates to.
| Parameter | |
|---|---|
| Name | Description |
expr |
ExpressionThe expression to get the type of. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the type operation. |
type(String fieldName)
public static Expression type(String fieldName)Creates an expression that returns a string indicating the type of the value this field evaluates to.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field to get the type of. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the type operation. |
unixMicrosToTimestamp(Expression expr)
public static Expression unixMicrosToTimestamp(Expression expr)Creates an expression that converts a Unix timestamp in microseconds to a Firestore timestamp.
| Parameter | |
|---|---|
| Name | Description |
expr |
ExpressionThe expression representing the Unix timestamp in microseconds. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the Firestore timestamp. |
unixMicrosToTimestamp(String fieldName)
public static Expression unixMicrosToTimestamp(String fieldName)Creates an expression that interprets a field's value as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the number of microseconds since epoch. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the timestamp. |
unixMillisToTimestamp(Expression expr)
public static Expression unixMillisToTimestamp(Expression expr)Creates an expression that interprets an expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
| Parameter | |
|---|---|
| Name | Description |
expr |
ExpressionThe expression representing the number of milliseconds since epoch. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the timestamp. |
unixMillisToTimestamp(String fieldName)
public static Expression unixMillisToTimestamp(String fieldName)Creates an expression that interprets a field's value as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the number of milliseconds since epoch. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the timestamp. |
unixSecondsToTimestamp(Expression expr)
public static Expression unixSecondsToTimestamp(Expression expr)Creates an expression that interprets an expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
| Parameter | |
|---|---|
| Name | Description |
expr |
ExpressionThe expression representing the number of seconds since epoch. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the timestamp. |
unixSecondsToTimestamp(String fieldName)
public static Expression unixSecondsToTimestamp(String fieldName)Creates an expression that interprets a field's value as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe name of the field containing the number of seconds since epoch. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the timestamp. |
vectorLength(Expression vectorExpression)
public static Expression vectorLength(Expression vectorExpression)Creates an expression that calculates the length of a vector.
| Parameter | |
|---|---|
| Name | Description |
vectorExpression |
ExpressionThe expression representing the vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the length of the vector. |
vectorLength(String fieldName)
public static Expression vectorLength(String fieldName)Creates an expression that calculates the length of a vector.
| Parameter | |
|---|---|
| Name | Description |
fieldName |
StringThe field name of the vector. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the length of the vector. |
xor(BooleanExpression condition, BooleanExpression[] conditions)
public static BooleanExpression xor(BooleanExpression condition, BooleanExpression[] conditions)Creates an expression that performs a logical 'XOR' operation.
| Parameters | |
|---|---|
| Name | Description |
condition |
BooleanExpressionThe first BooleanExpression. |
conditions |
BooleanExpression[]Additional BooleanExpressions. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the logical 'XOR' operation. |
Methods
abs()
public final Expression abs()Creates an expression that returns the absolute value of this numeric expression.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the absolute value operation. |
add(Object other)
public final Expression add(Object other)Creates an expression that adds this numeric expression to another numeric expression.
| Parameter | |
|---|---|
| Name | Description |
other |
ObjectNumeric expression to add. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the addition operation. |
arrayConcat(Expression[] otherArrays)
public final Expression arrayConcat(Expression[] otherArrays)Creates an expression that concatenates a field's array value with other arrays.
| Parameter | |
|---|---|
| Name | Description |
otherArrays |
Expression[]Optional additional array expressions or array literals to concatenate. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the arrayConcat operation. |
arrayContains(Object element)
public final BooleanExpression arrayContains(Object element)Creates an expression that checks if array contains a specific element.
| Parameter | |
|---|---|
| Name | Description |
element |
ObjectThe element to search for in the array. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the arrayContains operation. |
arrayContainsAll(Expression arrayExpression)
public final BooleanExpression arrayContainsAll(Expression arrayExpression)Creates an expression that checks if array contains all elements of arrayExpression.
| Parameter | |
|---|---|
| Name | Description |
arrayExpression |
ExpressionThe elements to check for in the array. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the arrayContainsAll operation. |
arrayContainsAll(List<Object> values)
public final BooleanExpression arrayContainsAll(List<Object> values)Creates an expression that checks if array contains all the specified values.
| Parameter | |
|---|---|
| Name | Description |
values |
List<Object>The elements to check for in the array. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the arrayContainsAll operation. |
arrayContainsAny(Expression arrayExpression)
public final BooleanExpression arrayContainsAny(Expression arrayExpression)Creates an expression that checks if array contains any elements of arrayExpression.
| Parameter | |
|---|---|
| Name | Description |
arrayExpression |
ExpressionThe elements to check for in the array. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the arrayContainsAny operation. |
arrayContainsAny(List<Object> values)
public final BooleanExpression arrayContainsAny(List<Object> values)Creates an expression that checks if array contains any of the specified values.
| Parameter | |
|---|---|
| Name | Description |
values |
List<Object>The elements to check for in the array. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the arrayContainsAny operation. |
arrayGet(Expression offset)
public final Expression arrayGet(Expression offset)Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end.
| Parameter | |
|---|---|
| Name | Description |
offset |
ExpressionAn Expression evaluating to the index of the element to return. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the arrayGet operation. |
arrayGet(int offset)
public final Expression arrayGet(int offset)Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end.
| Parameter | |
|---|---|
| Name | Description |
offset |
intAn Expression evaluating to the index of the element to return. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the arrayOffset operation. |
arrayLength()
public final Expression arrayLength()Creates an expression that calculates the length of an array expression.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the length of the array. |
arrayReverse()
public final Expression arrayReverse()Reverses the order of elements in the array.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the arrayReverse operation. |
arraySum()
public Expression arraySum()Creates an expression that returns the sum of the elements of this array expression.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the sum of the elements of the array. |
as(String alias)
public Selectable as(String alias)Assigns an alias to this expression.
Aliases are useful for renaming fields in the output of a stage or for giving meaningful names to calculated values.
| Parameter | |
|---|---|
| Name | Description |
alias |
StringThe alias to assign to this expression. |
| Returns | |
|---|---|
| Type | Description |
Selectable |
A new Selectable (typically an AliasedExpression) that wraps this expression and associates it with the provided alias. |
ascending()
public final Ordering ascending()Create an Ordering that sorts documents in ascending order based on value of this expression
| Returns | |
|---|---|
| Type | Description |
Ordering |
A new Ordering object with ascending sort by this expression. |
average()
public final AggregateFunction average()Creates an aggregation that calculates the average (mean) of this numeric expression across multiple stage inputs.
| Returns | |
|---|---|
| Type | Description |
AggregateFunction |
A new AggregateFunction representing the average aggregation. |
byteLength()
public final Expression byteLength()Creates an expression that calculates the length of a string in UTF-8 bytes, or just the length of a Blob.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the length of the string in bytes. |
ceil()
public final Expression ceil()Creates an expression that returns the smallest integer that isn't less than this numeric expression.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing an integer result from the ceil operation. |
charLength()
public final Expression charLength()Creates an expression that calculates the character length of this string expression in UTF8.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the charLength operation. |
collectionId()
public final Expression collectionId()Creates an expression that returns the collection ID from this path expression.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the collectionId operation. |
concat(Object[] others)
public Expression concat(Object[] others)Creates an expression that concatenates this expression with other values.
| Parameter | |
|---|---|
| Name | Description |
others |
Object[]Optional additional expressions or constants to concatenate. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the concatenated value. |
cosineDistance(Expression vector)
public final Expression cosineDistance(Expression vector)Calculates the Cosine distance between this and another vector expressions.
| Parameter | |
|---|---|
| Name | Description |
vector |
ExpressionThe other vector (represented as an Expression) to compare against. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the cosine distance between the two vectors. |
cosineDistance(double[] vector)
public final Expression cosineDistance(double[] vector)Calculates the Cosine distance between this vector expression and a vector literal.
| Parameter | |
|---|---|
| Name | Description |
vector |
double[]The other vector (as an array of doubles) to compare against. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the cosine distance between the two vectors. |
count()
public final AggregateFunction count()Creates an aggregation that counts the number of stage inputs with valid evaluations of the this expression.
| Returns | |
|---|---|
| Type | Description |
AggregateFunction |
A new AggregateFunction representing the count aggregation. |
countDistinct()
public final AggregateFunction countDistinct()Creates an aggregation that counts the number of distinct values of this expression.
| Returns | |
|---|---|
| Type | Description |
AggregateFunction |
A new AggregateFunction representing the count distinct aggregation. |
descending()
public final Ordering descending()Create an Ordering that sorts documents in descending order based on value of this expression
| Returns | |
|---|---|
| Type | Description |
Ordering |
A new Ordering object with descending sort by this expression. |
divide(Object other)
public final Expression divide(Object other)Creates an expression that divides this numeric expression by another numeric expression.
| Parameter | |
|---|---|
| Name | Description |
other |
ObjectNumeric expression to divide this numeric expression by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the division operation. |
documentId()
public final Expression documentId()Creates an expression that returns the document ID from this path expression.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the documentId operation. |
dotProduct(Expression vector)
public final Expression dotProduct(Expression vector)Calculates the dot product distance between this and another vector expression.
| Parameter | |
|---|---|
| Name | Description |
vector |
ExpressionThe other vector (represented as an Expression) to compare against. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the dot product distance between the two vectors. |
dotProduct(double[] vector)
public final Expression dotProduct(double[] vector)Calculates the dot product distance between this vector expression and a vector literal.
| Parameter | |
|---|---|
| Name | Description |
vector |
double[]The other vector (as an array of doubles) to compare against. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the dot product distance between the two vectors. |
endsWith(Object suffix)
public final BooleanExpression endsWith(Object suffix)Creates an expression that checks if this string expression ends with a given suffix.
| Parameter | |
|---|---|
| Name | Description |
suffix |
ObjectThe suffix string expression to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new Expression representing the 'ends with' comparison. |
equal(Object other)
public final BooleanExpression equal(Object other)Creates an expression that checks if this expression is equal to a value.
| Parameter | |
|---|---|
| Name | Description |
other |
ObjectThe value to compare to. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the equality comparison. |
equalAny(List<Object> other)
public final BooleanExpression equalAny(List<Object> other)Creates an expression that checks if this expression, when evaluated, is equal to any of the
provided values.
| Parameter | |
|---|---|
| Name | Description |
other |
List<Object>The values to check against. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'IN' comparison. |
euclideanDistance(Expression vector)
public final Expression euclideanDistance(Expression vector)Calculates the Euclidean distance between this and another vector expression.
| Parameter | |
|---|---|
| Name | Description |
vector |
ExpressionThe other vector (represented as an Expression) to compare against. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the Euclidean distance between the two vectors. |
euclideanDistance(double[] vector)
public final Expression euclideanDistance(double[] vector)Calculates the Euclidean distance between this vector expression and a vector literal.
| Parameter | |
|---|---|
| Name | Description |
vector |
double[]The other vector (as an array of doubles) to compare against. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the Euclidean distance between the two vectors. |
exists()
public final BooleanExpression exists()Creates an expression that checks if this expression evaluates to a name of the field that exists.
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new Expression representing the exists check. |
exp()
public final Expression exp()Creates an expression that returns Euler's number e raised to the power of this numeric expression.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the exponentiation. |
floor()
public final Expression floor()Creates an expression that returns the largest integer that isn't less than this numeric expression.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing an integer result from the floor operation. |
greaterThan(Object other)
public final BooleanExpression greaterThan(Object other)Creates an expression that checks if this expression is greater than a value.
| Parameter | |
|---|---|
| Name | Description |
other |
ObjectThe value to compare to. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the greater than comparison. |
greaterThanOrEqual(Object other)
public final BooleanExpression greaterThanOrEqual(Object other)Creates an expression that checks if this expression is greater than or equal to a
value.
| Parameter | |
|---|---|
| Name | Description |
other |
ObjectThe value to compare to. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the greater than or equal to comparison. |
ifAbsent(Object elseValue)
public Expression ifAbsent(Object elseValue)Creates an expression that returns a default value if this expression evaluates to an absent value.
| Parameter | |
|---|---|
| Name | Description |
elseValue |
ObjectThe default value. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the ifAbsent operation. |
ifError(Expression catchExpr)
public final Expression ifError(Expression catchExpr)Creates an expression that returns the catchExpr argument if there is an error, else
return the result of this expression.
| Parameter | |
|---|---|
| Name | Description |
catchExpr |
ExpressionThe catch expression that will be evaluated and returned if the this expression produces an error. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the ifError operation. |
ifError(Object catchValue)
public final Expression ifError(Object catchValue)Creates an expression that returns the catchValue argument if there is an error, else
return the result of this expression.
| Parameter | |
|---|---|
| Name | Description |
catchValue |
ObjectThe value that will be returned if this expression produces an error. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the ifError operation. |
isAbsent()
public final BooleanExpression isAbsent()Creates an expression that returns true if yhe result of this expression is absent. Otherwise, returns false even if the value is null.
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the isAbsent operation. |
isError()
public final BooleanExpression isError()Creates an expression that checks if this expression produces an error.
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the |
isNaN()
public final BooleanExpression isNaN()Creates an expression that checks if this expression evaluates to 'NaN' (Not a Number).
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the isNan operation. |
isNotNaN()
public final BooleanExpression isNotNaN()Creates an expression that checks if the results of this expression is NOT 'NaN' (Not a Number).
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the isNotNan operation. |
isNotNull()
public final BooleanExpression isNotNull()Creates an expression that checks if tbe result of this expression is not null.
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the isNotNull operation. |
isNull()
public final BooleanExpression isNull()Creates an expression that checks if tbe result of this expression is null.
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the isNull operation. |
join(Expression delimiter)
public Expression join(Expression delimiter)Creates an expression that joins the elements of this array expression into a string.
| Parameter | |
|---|---|
| Name | Description |
delimiter |
ExpressionThe delimiter to use. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the join operation. |
join(String delimiter)
public Expression join(String delimiter)Creates an expression that joins the elements of this array expression into a string.
| Parameter | |
|---|---|
| Name | Description |
delimiter |
StringThe delimiter to use. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the join operation. |
length()
public final Expression length()Creates an expression that calculates the length of the expression if it is a string, array, map, or Blob.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the length of the expression. |
lessThan(Object other)
public final BooleanExpression lessThan(Object other)Creates an expression that checks if this expression is less than a value.
| Parameter | |
|---|---|
| Name | Description |
other |
ObjectThe value to compare to. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the less than comparison. |
lessThanOrEqual(Object other)
public final BooleanExpression lessThanOrEqual(Object other)Creates an expression that checks if this expression is less than or equal to a value.
| Parameter | |
|---|---|
| Name | Description |
other |
ObjectThe value to compare to. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the less than or equal to comparison. |
like(Object pattern)
public final BooleanExpression like(Object pattern)Creates an expression that performs a case-sensitive wildcard string comparison.
| Parameter | |
|---|---|
| Name | Description |
pattern |
ObjectThe pattern to search for. You can use "%" as a wildcard character. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the like operation. |
ln()
public final Expression ln()Creates an expression that returns the natural logarithm (base e) of this numeric expression.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the natural logarithm. |
log10()
public Expression log10()Creates an expression that returns the base 10 logarithm of this numeric expression.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the base 10 logarithm. |
logicalMaximum(Object[] others)
public final Expression logicalMaximum(Object[] others)Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering.
| Parameter | |
|---|---|
| Name | Description |
others |
Object[]Optional additional expressions or literals. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the logical maximum operation. |
logicalMinimum(Object[] others)
public final Expression logicalMinimum(Object[] others)Creates an expression that returns the smallest value between multiple input expressions or literal values. Based on Firestore's value type ordering.
| Parameter | |
|---|---|
| Name | Description |
others |
Object[]Optional additional expressions or literals. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the logical minimum operation. |
mapGet(Object key)
public final Expression mapGet(Object key)Accesses a map (object) value using the provided key.
| Parameter | |
|---|---|
| Name | Description |
key |
ObjectThe key to access in the map. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the value associated with the given key in the map. |
mapMerge(Expression secondMap, Expression[] otherMaps)
public final Expression mapMerge(Expression secondMap, Expression[] otherMaps)Creates an expression that merges multiple maps into a single map. If multiple maps have the same key, the later value is used.
| Parameters | |
|---|---|
| Name | Description |
secondMap |
ExpressionMap expression that will be merged. |
otherMaps |
Expression[]Additional maps to merge. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the mapMerge operation. |
mapRemove(Expression key)
public final Expression mapRemove(Expression key)Creates an expression that removes a key from this map expression.
| Parameter | |
|---|---|
| Name | Description |
key |
ExpressionThe name of the key to remove from this map expression. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression that evaluates to a modified map. |
mapRemove(String key)
public final Expression mapRemove(String key)Creates an expression that removes a key from this map expression.
| Parameter | |
|---|---|
| Name | Description |
key |
StringThe name of the key to remove from this map expression. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression that evaluates to a modified map. |
maximum()
public final AggregateFunction maximum()Creates an aggregation that finds the maximum value of this expression across multiple stage inputs.
| Returns | |
|---|---|
| Type | Description |
AggregateFunction |
A new AggregateFunction representing the maximum aggregation. |
minimum()
public final AggregateFunction minimum()Creates an aggregation that finds the minimum value of this expression across multiple stage inputs.
| Returns | |
|---|---|
| Type | Description |
AggregateFunction |
A new AggregateFunction representing the minimum aggregation. |
mod(Object other)
public final Expression mod(Object other)Creates an expression that calculates the modulo (remainder) of dividing this numeric expressions by another numeric expression.
| Parameter | |
|---|---|
| Name | Description |
other |
ObjectThe numeric expression to divide this expression by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the modulo operation. |
multiply(Object other)
public final Expression multiply(Object other)Creates an expression that multiplies this numeric expression with another numeric expression.
| Parameter | |
|---|---|
| Name | Description |
other |
ObjectNumeric expression to multiply. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the multiplication operation. |
notEqual(Object other)
public final BooleanExpression notEqual(Object other)Creates an expression that checks if this expression is not equal to a value.
| Parameter | |
|---|---|
| Name | Description |
other |
ObjectThe value to compare to. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the inequality comparison. |
notEqualAny(List<Object> other)
public final BooleanExpression notEqualAny(List<Object> other)Creates an expression that checks if this expression, when evaluated, is not equal to all the
provided values.
| Parameter | |
|---|---|
| Name | Description |
other |
List<Object>The values to check against. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the 'NOT IN' comparison. |
pow(Expression exponent)
public final Expression pow(Expression exponent)Creates an expression that returns this numeric expression raised to the power of the
exponent. Returns infinity on overflow and zero on underflow.
| Parameter | |
|---|---|
| Name | Description |
exponent |
ExpressionThe numeric power to raise this numeric expression. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing a numeric result from raising this numeric
expression to the power of |
pow(Number exponent)
public final Expression pow(Number exponent)Creates an expression that returns this numeric expression raised to the power of the
exponent. Returns infinity on overflow and zero on underflow.
| Parameter | |
|---|---|
| Name | Description |
exponent |
NumberThe numeric power to raise this numeric expression. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing a numeric result from raising this numeric
expression to the power of |
regexContains(Object pattern)
public final BooleanExpression regexContains(Object pattern)Creates an expression that checks if this string expression contains a specified regular expression as a substring.
| Parameter | |
|---|---|
| Name | Description |
pattern |
ObjectThe regular expression to use for the search. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the contains regular expression comparison. |
regexMatch(Object pattern)
public final BooleanExpression regexMatch(Object pattern)Creates an expression that checks if this string expression matches a specified regular expression.
| Parameter | |
|---|---|
| Name | Description |
pattern |
ObjectThe regular expression to use for the match. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the regular expression match comparison. |
reverse()
public final Expression reverse()Creates an expression that reverses this expression, which must be a string, blob, or array.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the reversed value. |
round()
public final Expression round()Creates an expression that rounds this numeric expression to nearest integer.
Rounds away from zero in halfway cases.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing an integer result from the round operation. |
roundToPrecision(Expression decimalPlace)
public final Expression roundToPrecision(Expression decimalPlace)Creates an expression that rounds off this numeric expression to decimalPlace decimal
places if decimalPlace is positive, rounds off digits to the left of the decimal point
if decimalPlace is negative. Rounds away from zero in halfway cases.
| Parameter | |
|---|---|
| Name | Description |
decimalPlace |
ExpressionThe number of decimal places to round. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the round operation. |
roundToPrecision(int decimalPlace)
public final Expression roundToPrecision(int decimalPlace)Creates an expression that rounds off this numeric expression to decimalPlace decimal
places if decimalPlace is positive, rounds off digits to the left of the decimal point
if decimalPlace is negative. Rounds away from zero in halfway cases.
| Parameter | |
|---|---|
| Name | Description |
decimalPlace |
intThe number of decimal places to round. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the round operation. |
split(Expression delimiter)
public Expression split(Expression delimiter)Creates an expression that splits this string or blob expression by a delimiter.
| Parameter | |
|---|---|
| Name | Description |
delimiter |
ExpressionThe delimiter to split by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the split string or blob as an array. |
split(String delimiter)
public Expression split(String delimiter)Creates an expression that splits this string or blob expression by a delimiter.
| Parameter | |
|---|---|
| Name | Description |
delimiter |
StringThe delimiter to split by. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the split string or blob as an array. |
sqrt()
public final Expression sqrt()Creates an expression that returns the square root of this numeric expression.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the numeric result of the square root operation. |
startsWith(Object prefix)
public final BooleanExpression startsWith(Object prefix)Creates an expression that checks if this string expression starts with a given prefix.
| Parameter | |
|---|---|
| Name | Description |
prefix |
ObjectThe prefix string expression to check for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new Expression representing the the 'starts with' comparison. |
stringConcat(Expression[] others)
public final Expression stringConcat(Expression[] others)Creates an expression that concatenates string expressions together.
| Parameter | |
|---|---|
| Name | Description |
others |
Expression[]The string expressions or string constants to concatenate. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the concatenated string. |
stringConcat(String[] others)
public final Expression stringConcat(String[] others)Creates an expression that concatenates string expressions and string constants together.
| Parameter | |
|---|---|
| Name | Description |
others |
String[]The string expressions or string constants to concatenate. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the concatenated string. |
stringContains(Object substring)
public final BooleanExpression stringContains(Object substring)Creates an expression that checks if this string expression contains a specified substring.
| Parameter | |
|---|---|
| Name | Description |
substring |
ObjectThe expression representing the substring to search for. |
| Returns | |
|---|---|
| Type | Description |
BooleanExpression |
A new BooleanExpression representing the contains comparison. |
substring(Object index, Object length)
public final Expression substring(Object index, Object length)Creates an expression that returns a substring of the given string.
| Parameters | |
|---|---|
| Name | Description |
index |
ObjectThe starting index of the substring. |
length |
ObjectThe length of the substring. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the substring. |
subtract(Object other)
public final Expression subtract(Object other)Creates an expression that subtracts a numeric expressions from this numeric expression.
| Parameter | |
|---|---|
| Name | Description |
other |
ObjectConstant to subtract. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the subtract operation. |
sum()
public final AggregateFunction sum()Creates an aggregation that calculates the sum of this numeric expression across multiple stage inputs.
| Returns | |
|---|---|
| Type | Description |
AggregateFunction |
A new AggregateFunction representing the sum aggregation. |
timestampAdd(Expression unit, Expression amount)
public final Expression timestampAdd(Expression unit, Expression amount)Creates an expression that adds a specified amount of time to this timestamp expression.
| Parameters | |
|---|---|
| Name | Description |
unit |
ExpressionThe expression representing the unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
amount |
ExpressionThe expression representing the amount of time to add. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the resulting timestamp. |
timestampAdd(String unit, long amount)
public final Expression timestampAdd(String unit, long amount)Creates an expression that adds a specified amount of time to this timestamp expression.
| Parameters | |
|---|---|
| Name | Description |
unit |
StringThe unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
amount |
longThe amount of time to add. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the resulting timestamp. |
timestampSubtract(Expression unit, Expression amount)
public final Expression timestampSubtract(Expression unit, Expression amount)Creates an expression that subtracts a specified amount of time to this timestamp expression.
| Parameters | |
|---|---|
| Name | Description |
unit |
ExpressionThe expression representing the unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
amount |
ExpressionThe expression representing the amount of time to subtract. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the resulting timestamp. |
timestampSubtract(String unit, long amount)
public final Expression timestampSubtract(String unit, long amount)Creates an expression that subtracts a specified amount of time to this timestamp expression.
| Parameters | |
|---|---|
| Name | Description |
unit |
StringThe unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
amount |
longThe amount of time to subtract. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the resulting timestamp. |
timestampToUnixMicros()
public final Expression timestampToUnixMicros()Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the number of microseconds since epoch. |
timestampToUnixMillis()
public final Expression timestampToUnixMillis()Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the number of milliseconds since epoch. |
timestampToUnixSeconds()
public final Expression timestampToUnixSeconds()Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC).
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the number of seconds since epoch. |
timestampTruncate(Expression granularity)
public final Expression timestampTruncate(Expression granularity)Creates an expression that truncates this timestamp expression to a specified granularity.
| Parameter | |
|---|---|
| Name | Description |
granularity |
ExpressionThe granularity expression to truncate to. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "day", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the truncated timestamp. |
timestampTruncate(String granularity)
public final Expression timestampTruncate(String granularity)Creates an expression that truncates this timestamp expression to a specified granularity.
| Parameter | |
|---|---|
| Name | Description |
granularity |
StringThe granularity to truncate to. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "day", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the truncated timestamp. |
toLower()
public final Expression toLower()Creates an expression that converts this string expression to lowercase.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the lowercase string. |
toUpper()
public final Expression toUpper()Creates an expression that converts this string expression to uppercase.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the lowercase string. |
trim()
public final Expression trim()Creates an expression that removes leading and trailing whitespace from this string expression.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the trimmed string. |
trimValue(Expression characters)
public Expression trimValue(Expression characters)Creates an expression that removes specified characters from the beginning and end of this string or blob expression.
| Parameter | |
|---|---|
| Name | Description |
characters |
ExpressionThe expression representing the characters to remove. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the trimmed string or blob. |
trimValue(String characters)
public Expression trimValue(String characters)Creates an expression that removes specified characters from the beginning and end of this string or blob expression.
| Parameter | |
|---|---|
| Name | Description |
characters |
StringThe characters to remove. |
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the trimmed string or blob. |
type()
public final Expression type()Creates an expression that returns a string indicating the type of the value this expression evaluates to.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the type operation. |
unixMicrosToTimestamp()
public final Expression unixMicrosToTimestamp()Creates an expression that interprets this expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the timestamp. |
unixMillisToTimestamp()
public final Expression unixMillisToTimestamp()Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the timestamp. |
unixSecondsToTimestamp()
public final Expression unixSecondsToTimestamp()Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the timestamp. |
vectorLength()
public final Expression vectorLength()Creates an expression that calculates the length (dimension) of a Firestore Vector.
| Returns | |
|---|---|
| Type | Description |
Expression |
A new Expression representing the length (dimension) of the vector. |