> Documentation index: https://firebase.google.com/docs/reference/llms.txt

# Expression


```
public abstract class Expression
```

<br />

Known direct subclasses [BooleanExpression](https://firebase.google.com/docs/reference/android/com/google/firebase/firestore/pipeline/BooleanExpression.md.txt), [FunctionExpression](https://firebase.google.com/docs/reference/android/com/google/firebase/firestore/pipeline/FunctionExpression.md.txt), [Selectable](https://firebase.google.com/docs/reference/android/com/google/firebase/firestore/pipeline/Selectable.md.txt)

|---|---|
| `BooleanExpression` | A class that represents a filter condition. |
| `FunctionExpression` | This class defines the base class for Firestore `Pipeline` functions, which can be evaluated within pipeline execution. |
| `Selectable` | Expressions that have an alias are `Selectable` |

Known indirect subclasses [AliasedExpression](https://firebase.google.com/docs/reference/android/com/google/firebase/firestore/pipeline/AliasedExpression.md.txt), [Field](https://firebase.google.com/docs/reference/android/com/google/firebase/firestore/pipeline/Field.md.txt)

|---|---|
| `AliasedExpression` | Represents an expression that will be given the alias in the output document. |
| `Field` | Represents a reference to a field in a Firestore document. |

*** ** * ** ***

Represents an expression that can be evaluated to a value within the execution of a `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.

## Summary

| ### Nested types |
|---|
| `public static class Expression.Companion` |

| ### Public methods |
|---|---|
| `final @NonNull Expression` | `abs()` Creates an expression that returns the absolute value of this expression. |
| `static final @NonNull Expression` | `abs(@NonNull Expression numericExpr)` Creates an expression that returns the absolute value of `numericExpr`. |
| `static final @NonNull Expression` | `abs(@NonNull String numericField)` Creates an expression that returns the absolute value of `numericField`. |
| `final @NonNull Expression` | `add(@NonNull Expression second)` Creates an expression that adds this numeric expression to another numeric expression. |
| `final @NonNull Expression` | `add(@NonNull Number second)` Creates an expression that adds this numeric expression to a constants. |
| `static final @NonNull Expression` | `add(@NonNull Expression first, @NonNull Expression second)` Creates an expression that adds numeric expressions. |
| `static final @NonNull Expression` | `add(@NonNull Expression first, @NonNull Number second)` Creates an expression that adds numeric expressions with a constant. |
| `static final @NonNull Expression` | `add(@NonNull String numericFieldName, @NonNull Expression second)` Creates an expression that adds a numeric field with a numeric expression. |
| `static final @NonNull Expression` | `add(@NonNull String numericFieldName, @NonNull Number second)` Creates an expression that adds a numeric field with constant. |
| `@NonNull AliasedExpression` | `alias(@NonNull String alias)` Assigns an alias to this expression. |
| `static final @NonNull BooleanExpression` | `and( @NonNull BooleanExpression condition, @NonNull BooleanExpression conditions )` Creates an expression that performs a logical 'AND' operation. |
| `static final @NonNull Expression` | `array(@NonNull List<Object> elements)` Creates an expression that creates a Firestore array value from an input array. |
| `static final @NonNull Expression` | `array(Object elements)` Creates an expression that creates a Firestore array value from an input array. |
| `final @NonNull AggregateFunction` | `arrayAgg()` Creates an aggregation that collects all values of this expression across multiple stage inputs into an array. |
| `final @NonNull AggregateFunction` | `arrayAggDistinct()` Creates an aggregation that collects all distinct values of this expression across multiple stage inputs into an array. |
| `final @NonNull Expression` | `arrayConcat(@NonNull Object secondArray, @NonNull Object otherArrays)` Creates an expression that concatenates a field's array value with other arrays. |
| `final @NonNull Expression` | `arrayConcat(@NonNull Expression secondArray, @NonNull Object otherArrays)` Creates an expression that concatenates a field's array value with other arrays. |
| `static final @NonNull Expression` | `arrayConcat( @NonNull Expression firstArray, @NonNull Object secondArray, @NonNull Object otherArrays )` Creates an expression that concatenates an array with other arrays. |
| `static final @NonNull Expression` | `arrayConcat( @NonNull Expression firstArray, @NonNull Expression secondArray, @NonNull Object otherArrays )` Creates an expression that concatenates an array with other arrays. |
| `static final @NonNull Expression` | `arrayConcat( @NonNull String firstArrayField, @NonNull Object secondArray, @NonNull Object otherArrays )` Creates an expression that concatenates a field's array value with other arrays. |
| `static final @NonNull Expression` | `arrayConcat( @NonNull String firstArrayField, @NonNull Expression secondArray, @NonNull Object otherArrays )` Creates an expression that concatenates a field's array value with other arrays. |
| `final @NonNull BooleanExpression` | `arrayContains(@NonNull Object element)` Creates an expression that checks if array contains a specific `element`. |
| `final @NonNull BooleanExpression` | `arrayContains(@NonNull Expression element)` Creates an expression that checks if array contains a specific `element`. |
| `static final @NonNull BooleanExpression` | `arrayContains(@NonNull Expression array, @NonNull Object element)` Creates an expression that checks if the `array` contains a specific `element`. |
| `static final @NonNull BooleanExpression` | `arrayContains(@NonNull Expression array, @NonNull Expression element)` Creates an expression that checks if the array contains a specific `element`. |
| `static final @NonNull BooleanExpression` | `arrayContains(@NonNull String arrayFieldName, @NonNull Object element)` Creates an expression that checks if the array field contains a specific `element`. |
| `static final @NonNull BooleanExpression` | `arrayContains(@NonNull String arrayFieldName, @NonNull Expression element)` Creates an expression that checks if the array field contains a specific `element`. |
| `final @NonNull BooleanExpression` | `arrayContainsAll(@NonNull Expression arrayExpression)` Creates an expression that checks if array contains all elements of `arrayExpression`. |
| `final @NonNull BooleanExpression` | `arrayContainsAll(@NonNull List<@NonNull Object> values)` Creates an expression that checks if array contains all the specified `values`. |
| `static final @NonNull BooleanExpression` | `arrayContainsAll( @NonNull Expression array, @NonNull Expression arrayExpression )` Creates an expression that checks if `array` contains all elements of `arrayExpression`. |
| `static final @NonNull BooleanExpression` | `arrayContainsAll( @NonNull Expression array, @NonNull List<@NonNull Object> values )` Creates an expression that checks if `array` contains all the specified `values`. |
| `static final @NonNull BooleanExpression` | `arrayContainsAll( @NonNull String arrayFieldName, @NonNull Expression arrayExpression )` Creates an expression that checks if array field contains all elements of `arrayExpression`. |
| `static final @NonNull BooleanExpression` | `arrayContainsAll( @NonNull String arrayFieldName, @NonNull List<@NonNull Object> values )` Creates an expression that checks if array field contains all the specified `values`. |
| `final @NonNull BooleanExpression` | `arrayContainsAny(@NonNull Expression arrayExpression)` Creates an expression that checks if array contains any elements of `arrayExpression`. |
| `final @NonNull BooleanExpression` | `arrayContainsAny(@NonNull List<@NonNull Object> values)` Creates an expression that checks if array contains any of the specified `values`. |
| `static final @NonNull BooleanExpression` | `arrayContainsAny( @NonNull Expression array, @NonNull Expression arrayExpression )` Creates an expression that checks if `array` contains any elements of `arrayExpression`. |
| `static final @NonNull BooleanExpression` | `arrayContainsAny( @NonNull Expression array, @NonNull List<@NonNull Object> values )` Creates an expression that checks if `array` contains any of the specified `values`. |
| `static final @NonNull BooleanExpression` | `arrayContainsAny( @NonNull String arrayFieldName, @NonNull Expression arrayExpression )` Creates an expression that checks if array field contains any elements of `arrayExpression`. |
| `static final @NonNull BooleanExpression` | `arrayContainsAny( @NonNull String arrayFieldName, @NonNull List<@NonNull Object> values )` Creates an expression that checks if array field contains any of the specified `values`. |
| `final @NonNull Expression` | `arrayFilter(@NonNull String alias, @NonNull BooleanExpression filter)` Filters this array expression based on a predicate. |
| `static final @NonNull Expression` | `arrayFilter( @NonNull Expression array, @NonNull String alias, @NonNull BooleanExpression filter )` Filters an `array` expression based on a predicate. |
| `static final @NonNull Expression` | `arrayFilter( @NonNull String arrayFieldName, @NonNull String alias, @NonNull BooleanExpression filter )` Filters an array field based on a predicate. |
| `final @NonNull Expression` | `arrayFirst()` Creates an expression that returns the first element of an array expression. |
| `static final @NonNull Expression` | `arrayFirst(@NonNull Expression array)` Creates an expression that returns the first element of an `array` expression. |
| `static final @NonNull Expression` | `arrayFirst(@NonNull String arrayFieldName)` Creates an expression that returns the first element of an array field. |
| `final @NonNull Expression` | `arrayFirstN(@NonNull Expression n)` Creates an expression that returns the first N elements of an array expression. |
| `final @NonNull Expression` | `arrayFirstN(int n)` Creates an expression that returns the first N elements of an array expression. |
| `static final @NonNull Expression` | `arrayFirstN(@NonNull Expression array, @NonNull Expression n)` Creates an expression that returns the first `n` elements of an `array` expression. |
| `static final @NonNull Expression` | `arrayFirstN(@NonNull Expression array, int n)` Creates an expression that returns the first `n` elements of an `array` expression. |
| `static final @NonNull Expression` | `arrayFirstN(@NonNull String arrayFieldName, @NonNull Expression n)` Creates an expression that returns the first `n` elements of an array field. |
| `static final @NonNull Expression` | `arrayFirstN(@NonNull String arrayFieldName, int n)` Creates an expression that returns the first `n` elements of an array field. |
| `final @NonNull Expression` | `arrayGet(@NonNull Expression offset)` Creates an expression that indexes into an array from the beginning or end and return the element. |
| `final @NonNull Expression` | `arrayGet(int offset)` Creates an expression that indexes into an array from the beginning or end and return the element. |
| `static final @NonNull Expression` | `arrayGet(@NonNull Expression array, @NonNull Expression offset)` Creates an expression that indexes into an array from the beginning or end and return the element. |
| `static final @NonNull Expression` | `arrayGet(@NonNull Expression array, int offset)` Creates an expression that indexes into an array from the beginning or end and return the element. |
| `static final @NonNull Expression` | `arrayGet(@NonNull String arrayFieldName, @NonNull Expression offset)` Creates an expression that indexes into an array from the beginning or end and return the element. |
| `static final @NonNull Expression` | `arrayGet(@NonNull String arrayFieldName, int offset)` Creates an expression that indexes into an array from the beginning or end and return the element. |
| `final @NonNull Expression` | `arrayIndexOf(Object value)` Creates an expression that returns the first index where the specified `value` occurs in the `array`. |
| `static final @NonNull Expression` | `arrayIndexOf(@NonNull Expression array, Object value)` Creates an expression that returns the index of the first occurrence of the specified `value` in the `array`, or -1 if the value is not found. |
| `static final @NonNull Expression` | `arrayIndexOf(@NonNull String arrayFieldName, Object value)` Creates an expression that returns the index of the first occurrence of the specified `value` in the `array`, or -1 if the value is not found. |
| `final @NonNull Expression` | `arrayIndexOfAll(Object value)` Creates an expression that returns a list of all indices where the specified `value` occurs in the `array`. |
| `static final @NonNull Expression` | `arrayIndexOfAll(@NonNull Expression array, Object value)` Creates an expression that returns a list of all indices where the specified `value` occurs in the `array`. |
| `static final @NonNull Expression` | `arrayIndexOfAll(@NonNull String arrayFieldName, Object value)` Creates an expression that returns a list of all indices where the specified `value` occurs in the `array`. |
| `final @NonNull Expression` | `arrayLast()` Creates an expression that returns the last element of an array expression. |
| `static final @NonNull Expression` | `arrayLast(@NonNull Expression array)` Creates an expression that returns the last element of an `array` expression. |
| `static final @NonNull Expression` | `arrayLast(@NonNull String arrayFieldName)` Creates an expression that returns the last element of an array field. |
| `final @NonNull Expression` | `arrayLastIndexOf(Object value)` Creates an expression that returns the last index where the specified `value` occurs in the `array`. |
| `static final @NonNull Expression` | `arrayLastIndexOf(@NonNull Expression array, Object value)` Creates an expression that returns the index of the last occurrence of the specified `value` in the `array`, or -1 if the value is not found. |
| `static final @NonNull Expression` | `arrayLastIndexOf(@NonNull String arrayFieldName, Object value)` Creates an expression that returns the index of the last occurrence of the specified `value` in the `array`, or -1 if the value is not found. |
| `final @NonNull Expression` | `arrayLastN(@NonNull Expression n)` Creates an expression that returns the last N elements of an array expression. |
| `final @NonNull Expression` | `arrayLastN(int n)` Creates an expression that returns the last N elements of an array expression. |
| `static final @NonNull Expression` | `arrayLastN(@NonNull Expression array, @NonNull Expression n)` Creates an expression that returns the last `n` elements of an `array` expression. |
| `static final @NonNull Expression` | `arrayLastN(@NonNull Expression array, int n)` Creates an expression that returns the last `n` elements of an `array` expression. |
| `static final @NonNull Expression` | `arrayLastN(@NonNull String arrayFieldName, @NonNull Expression n)` Creates an expression that returns the last `n` elements of an array field. |
| `static final @NonNull Expression` | `arrayLastN(@NonNull String arrayFieldName, int n)` Creates an expression that returns the last `n` elements of an array field. |
| `final @NonNull Expression` | `arrayLength()` Creates an expression that calculates the length of an array expression. |
| `static final @NonNull Expression` | `arrayLength(@NonNull Expression array)` Creates an expression that calculates the length of an `array` expression. |
| `static final @NonNull Expression` | `arrayLength(@NonNull String arrayFieldName)` Creates an expression that calculates the length of an array field. |
| `final @NonNull Expression` | `arrayMaximum()` Creates an expression that returns the maximum value of an array expression. |
| `static final @NonNull Expression` | `arrayMaximum(@NonNull Expression array)` Creates an expression that returns the maximum element of the `array`. |
| `static final @NonNull Expression` | `arrayMaximum(@NonNull String arrayFieldName)` Creates an expression that returns the maximum element of an array field. |
| `final @NonNull Expression` | `arrayMaximumN(@NonNull Expression n)` Creates an expression that returns the first `n` largest elements of the `array`. |
| `final @NonNull Expression` | `arrayMaximumN(int n)` Creates an expression that returns the first `n` largest elements of the `array`. |
| `static final @NonNull Expression` | `arrayMaximumN(@NonNull Expression array, @NonNull Expression n)` Creates an expression that returns the first `n` largest elements of the `array`. |
| `static final @NonNull Expression` | `arrayMaximumN(@NonNull Expression array, int n)` Creates an expression that returns the first `n` largest elements of the `array`. |
| `static final @NonNull Expression` | `arrayMaximumN(@NonNull String arrayFieldName, @NonNull Expression n)` Creates an expression that returns the first `n` largest elements of the `array`. |
| `static final @NonNull Expression` | `arrayMaximumN(@NonNull String arrayFieldName, int n)` Creates an expression that returns the first `n` largest elements of the `array`. |
| `final @NonNull Expression` | `arrayMinimum()` Creates an expression that returns the minimum value of an array expression. |
| `static final @NonNull Expression` | `arrayMinimum(@NonNull Expression array)` Creates an expression that returns the minimum element of the `array`. |
| `static final @NonNull Expression` | `arrayMinimum(@NonNull String arrayFieldName)` Creates an expression that returns the minimum element of an array field. |
| `final @NonNull Expression` | `arrayMinimumN(@NonNull Expression n)` Creates an expression that returns the first `n` smallest elements of the `array`. |
| `final @NonNull Expression` | `arrayMinimumN(int n)` Creates an expression that returns the first `n` smallest elements of the `array`. |
| `static final @NonNull Expression` | `arrayMinimumN(@NonNull Expression array, @NonNull Expression n)` Creates an expression that returns the first `n` smallest elements of the `array`. |
| `static final @NonNull Expression` | `arrayMinimumN(@NonNull Expression array, int n)` Creates an expression that returns the first `n` smallest elements of the `array`. |
| `static final @NonNull Expression` | `arrayMinimumN(@NonNull String arrayFieldName, @NonNull Expression n)` Creates an expression that returns the first `n` smallest elements of the `array`. |
| `static final @NonNull Expression` | `arrayMinimumN(@NonNull String arrayFieldName, int n)` Creates an expression that returns the first `n` smallest elements of the `array`. |
| `final @NonNull Expression` | `arrayReverse()` Reverses the order of elements in the array. |
| `static final @NonNull Expression` | `arrayReverse(@NonNull Expression array)` Reverses the order of elements in the `array`. |
| `static final @NonNull Expression` | `arrayReverse(@NonNull String arrayFieldName)` Reverses the order of elements in the array field. |
| `final @NonNull Expression` | `arraySlice(@NonNull Expression offset, @NonNull Expression length)` Creates an expression that returns a slice of this array expression. |
| `final @NonNull Expression` | `arraySlice(int offset, int length)` Creates an expression that returns a slice of this array expression. |
| `static final @NonNull Expression` | `arraySlice( @NonNull Expression array, @NonNull Expression offset, @NonNull Expression length )` Creates an expression that returns a slice of an `array` expression. |
| `static final @NonNull Expression` | `arraySlice(@NonNull Expression array, int offset, int length)` Creates an expression that returns a slice of an `array` expression. |
| `static final @NonNull Expression` | `arraySlice( @NonNull String arrayFieldName, @NonNull Expression offset, @NonNull Expression length )` Creates an expression that returns a slice of an array field. |
| `static final @NonNull Expression` | `arraySlice(@NonNull String arrayFieldName, int offset, int length)` Creates an expression that returns a slice of an array field. |
| `final @NonNull Expression` | `arraySliceToEnd(@NonNull Expression offset)` Creates an expression that returns a slice of this array expression to its end. |
| `final @NonNull Expression` | `arraySliceToEnd(int offset)` Creates an expression that returns a slice of this array expression to its end. |
| `static final @NonNull Expression` | `arraySliceToEnd(@NonNull Expression array, @NonNull Expression offset)` Creates an expression that returns a slice of an `array` expression to its end. |
| `static final @NonNull Expression` | `arraySliceToEnd(@NonNull Expression array, int offset)` Creates an expression that returns a slice of an `array` expression to its end. |
| `static final @NonNull Expression` | `arraySliceToEnd(@NonNull String arrayFieldName, @NonNull Expression offset)` Creates an expression that returns a slice of an array field to its end. |
| `static final @NonNull Expression` | `arraySliceToEnd(@NonNull String arrayFieldName, int offset)` Creates an expression that returns a slice of an array field to its end. |
| `final @NonNull Expression` | `arraySum()` Creates an expression that returns the sum of the elements in this array expression. |
| `static final @NonNull Expression` | `arraySum(@NonNull Expression array)` Creates an expression that returns the sum of the elements in an array. |
| `static final @NonNull Expression` | `arraySum(@NonNull String arrayFieldName)` Creates an expression that returns the sum of the elements in an array field. |
| `final @NonNull Expression` | `arrayTransform(@NonNull String elementAlias, @NonNull Expression transform)` Creates an expression that applies a provided transformation to each element in an array. |
| `static final @NonNull Expression` | `arrayTransform( @NonNull Expression array, @NonNull String elementAlias, @NonNull Expression transform )` Creates an expression that applies a provided transformation to each element in an array. |
| `static final @NonNull Expression` | `arrayTransform( @NonNull String arrayFieldName, @NonNull String elementAlias, @NonNull Expression transform )` Creates an expression that applies a provided transformation to each element in an array. |
| `final @NonNull Expression` | `arrayTransformWithIndex( @NonNull String elementAlias, @NonNull String indexAlias, @NonNull Expression transform )` Creates an expression that applies a provided transformation to each element in an array, providing the element's index to the transformation expression. |
| `static final @NonNull Expression` | `arrayTransformWithIndex( @NonNull Expression array, @NonNull String elementAlias, @NonNull String indexAlias, @NonNull Expression transform )` Creates an expression that applies a provided transformation to each element in an array, providing the element's index to the transformation expression. |
| `static final @NonNull Expression` | `arrayTransformWithIndex( @NonNull String arrayFieldName, @NonNull String elementAlias, @NonNull String indexAlias, @NonNull Expression transform )` Creates an expression that applies a provided transformation to each element in an array, providing the element's index to the transformation expression. |
| `final @NonNull BooleanExpression` | `asBoolean()` Casts the expression to a `BooleanExpression`. |
| `final @NonNull Ordering` | `ascending()` Create an `Ordering` that sorts documents in ascending order based on value of this expression |
| `final @NonNull AggregateFunction` | `average()` Creates an aggregation that calculates the average (mean) of this numeric expression across multiple stage inputs. |
| `final @NonNull Expression` | `bitAnd(@NonNull byte[] bitsOther)` Creates an expression that applies a bitwise AND operation with a constant. |
| `final @NonNull Expression` | `bitAnd(@NonNull Expression bitsOther)` Creates an expression that applies a bitwise AND operation with other expression. |
| `static final @NonNull Expression` | `bitAnd(@NonNull Expression bits, @NonNull byte[] bitsOther)` Creates an expression that applies a bitwise AND operation between an expression and a constant. |
| `static final @NonNull Expression` | `bitAnd(@NonNull Expression bits, @NonNull Expression bitsOther)` Creates an expression that applies a bitwise AND operation between two expressions. |
| `static final @NonNull Expression` | `bitAnd(@NonNull String bitsFieldName, @NonNull byte[] bitsOther)` Creates an expression that applies a bitwise AND operation between an field and constant. |
| `static final @NonNull Expression` | `bitAnd(@NonNull String bitsFieldName, @NonNull Expression bitsOther)` Creates an expression that applies a bitwise AND operation between an field and an expression. |
| `final @NonNull Expression` | `bitLeftShift(int number)` Creates an expression that applies a bitwise left shift operation with a constant. |
| `final @NonNull Expression` | `bitLeftShift(@NonNull Expression numberExpr)` Creates an expression that applies a bitwise left shift operation with an expression. |
| `static final @NonNull Expression` | `bitLeftShift(@NonNull Expression bits, int number)` Creates an expression that applies a bitwise left shift operation between an expression and a constant. |
| `static final @NonNull Expression` | `bitLeftShift(@NonNull Expression bits, @NonNull Expression numberExpr)` Creates an expression that applies a bitwise left shift operation between two expressions. |
| `static final @NonNull Expression` | `bitLeftShift(@NonNull String bitsFieldName, int number)` Creates an expression that applies a bitwise left shift operation between a field and a constant. |
| `static final @NonNull Expression` | `bitLeftShift(@NonNull String bitsFieldName, @NonNull Expression numberExpr)` Creates an expression that applies a bitwise left shift operation between a field and an expression. |
| `final @NonNull Expression` | `bitNot()` Creates an expression that applies a bitwise NOT operation to this expression. |
| `static final @NonNull Expression` | `bitNot(@NonNull Expression bits)` Creates an expression that applies a bitwise NOT operation to an expression. |
| `static final @NonNull Expression` | `bitNot(@NonNull String bitsFieldName)` Creates an expression that applies a bitwise NOT operation to a field. |
| `final @NonNull Expression` | `bitOr(@NonNull byte[] bitsOther)` Creates an expression that applies a bitwise OR operation with a constant. |
| `final @NonNull Expression` | `bitOr(@NonNull Expression bitsOther)` Creates an expression that applies a bitwise OR operation with other expression. |
| `static final @NonNull Expression` | `bitOr(@NonNull Expression bits, @NonNull byte[] bitsOther)` Creates an expression that applies a bitwise OR operation between an expression and a constant. |
| `static final @NonNull Expression` | `bitOr(@NonNull Expression bits, @NonNull Expression bitsOther)` Creates an expression that applies a bitwise OR operation between two expressions. |
| `static final @NonNull Expression` | `bitOr(@NonNull String bitsFieldName, @NonNull byte[] bitsOther)` Creates an expression that applies a bitwise OR operation between an field and constant. |
| `static final @NonNull Expression` | `bitOr(@NonNull String bitsFieldName, @NonNull Expression bitsOther)` Creates an expression that applies a bitwise OR operation between an field and an expression. |
| `final @NonNull Expression` | `bitRightShift(int number)` Creates an expression that applies a bitwise right shift operation with a constant. |
| `final @NonNull Expression` | `bitRightShift(@NonNull Expression numberExpr)` Creates an expression that applies a bitwise right shift operation with an expression. |
| `static final @NonNull Expression` | `bitRightShift(@NonNull Expression bits, int number)` Creates an expression that applies a bitwise right shift operation between an expression and a constant. |
| `static final @NonNull Expression` | `bitRightShift(@NonNull Expression bits, @NonNull Expression numberExpr)` Creates an expression that applies a bitwise right shift operation between two expressions. |
| `static final @NonNull Expression` | `bitRightShift(@NonNull String bitsFieldName, int number)` Creates an expression that applies a bitwise right shift operation between a field and a constant. |
| `static final @NonNull Expression` | `bitRightShift( @NonNull String bitsFieldName, @NonNull Expression numberExpr )` Creates an expression that applies a bitwise right shift operation between a field and an expression. |
| `final @NonNull Expression` | `bitXor(@NonNull byte[] bitsOther)` Creates an expression that applies a bitwise XOR operation with a constant. |
| `final @NonNull Expression` | `bitXor(@NonNull Expression bitsOther)` Creates an expression that applies a bitwise XOR operation with an expression. |
| `static final @NonNull Expression` | `bitXor(@NonNull Expression bits, @NonNull byte[] bitsOther)` Creates an expression that applies a bitwise XOR operation between an expression and a constant. |
| `static final @NonNull Expression` | `bitXor(@NonNull Expression bits, @NonNull Expression bitsOther)` Creates an expression that applies a bitwise XOR operation between two expressions. |
| `static final @NonNull Expression` | `bitXor(@NonNull String bitsFieldName, @NonNull byte[] bitsOther)` Creates an expression that applies a bitwise XOR operation between an field and constant. |
| `static final @NonNull Expression` | `bitXor(@NonNull String bitsFieldName, @NonNull Expression bitsOther)` Creates an expression that applies a bitwise XOR operation between an field and an expression. |
| `final @NonNull Expression` | `byteLength()` Creates an expression that calculates the length of a string in UTF-8 bytes, or just the length of a Blob. |
| `static final @NonNull Expression` | `byteLength(@NonNull 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. |
| `static final @NonNull Expression` | `byteLength(@NonNull Expression value)` Creates an expression that calculates the length of a string in UTF-8 bytes, or just the length of a Blob. |
| `final @NonNull Expression` | `ceil()` Creates an expression that returns the smallest integer that isn't less than this numeric expression. |
| `static final @NonNull Expression` | `ceil(@NonNull Expression numericExpr)` Creates an expression that returns the smallest integer that isn't less than `numericExpr`. |
| `static final @NonNull Expression` | `ceil(@NonNull String numericField)` Creates an expression that returns the smallest integer that isn't less than `numericField`. |
| `final @NonNull Expression` | `charLength()` Creates an expression that calculates the character length of this string expression in UTF8. |
| `static final @NonNull Expression` | `charLength(@NonNull Expression expr)` Creates an expression that calculates the character length of a string expression in UTF8. |
| `static final @NonNull Expression` | `charLength(@NonNull String fieldName)` Creates an expression that calculates the character length of a string field in UTF8. |
| `final @NonNull Expression` | `coalesce(@NonNull Object replacement, @NonNull Object others)` Creates an expression that returns the first non-null, non-absent argument, without evaluating the rest of the arguments. |
| `static final @NonNull Expression` | `coalesce( @NonNull Expression expression, @NonNull Object replacement, @NonNull Object others )` Creates an expression that returns the first non-null, non-absent argument, without evaluating the rest of the arguments. |
| `static final @NonNull Expression` | `coalesce( @NonNull String fieldName, @NonNull Object replacement, @NonNull Object others )` Creates an expression that returns the first non-null, non-absent argument, without evaluating the rest of the arguments. |
| `final @NonNull Expression` | `collectionId()` Creates an expression that returns the collection ID from this path expression. |
| `static final @NonNull Expression` | `collectionId(@NonNull Expression path)` Creates an expression that returns the collection ID from a path. |
| `static final @NonNull Expression` | `collectionId(@NonNull String pathField)` Creates an expression that returns the collection ID from a path. |
| `final @NonNull Expression` | `concat(@NonNull Object second, @NonNull Object others)` Creates an expression that concatenates this expression's value with others. |
| `final @NonNull Expression` | `concat(@NonNull Expression second, @NonNull Object others)` Creates an expression that concatenates this expression's value with others. |
| `static final @NonNull Expression` | `concat( @NonNull Expression first, @NonNull Object second, @NonNull Object others )` Creates an expression that concatenates strings, arrays, or blobs. |
| `static final @NonNull Expression` | `concat( @NonNull Expression first, @NonNull Expression second, @NonNull Object others )` Creates an expression that concatenates strings, arrays, or blobs. |
| `static final @NonNull Expression` | `concat(@NonNull String first, @NonNull Object second, @NonNull Object others)` Creates an expression that concatenates strings, arrays, or blobs. |
| `static final @NonNull Expression` | `concat( @NonNull String first, @NonNull Expression second, @NonNull Object others )` Creates an expression that concatenates strings, arrays, or blobs. |
| `static final @NonNull Expression` | `conditional( @NonNull BooleanExpression condition, @NonNull Expression thenExpr, @NonNull 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. |
| `static final @NonNull Expression` | `conditional( @NonNull BooleanExpression condition, @NonNull Object thenValue, @NonNull Object elseValue )` Creates a conditional expression that evaluates to a `thenValue` if a condition is true or an `elseValue` if the condition is false. |
| `static final @NonNull Expression` | `constant(@NonNull DocumentReference ref)` Create a constant for a `DocumentReference` value. |
| `static final @NonNull Expression` | `constant(@NonNull Blob value)` Create a constant for a `Blob` value. |
| `static final @NonNull BooleanExpression` | `constant(boolean value)` Create a constant for a `Boolean` value. |
| `static final @NonNull Expression` | `constant(@NonNull byte[] value)` Create a constant for a bytes value. |
| `static final @NonNull Expression` | `constant(@NonNull Date value)` Create a constant for a `Date` value. |
| `static final @NonNull Expression` | `constant(@NonNull GeoPoint value)` Create a constant for a `GeoPoint` value. |
| `static final @NonNull Expression` | `constant(@NonNull Number value)` Create a constant for a `Number` value. |
| `static final @NonNull Expression` | `constant(@NonNull String value)` Create a constant for a `String` value. |
| `static final @NonNull Expression` | `constant(@NonNull Timestamp value)` Create a constant for a `Timestamp` value. |
| `static final @NonNull Expression` | `constant(@NonNull VectorValue value)` Create a constant for a `VectorValue` value. |
| `final @NonNull Expression` | `cosineDistance(@NonNull double[] vector)` Calculates the Cosine distance between this vector expression and a vector literal. |
| `final @NonNull Expression` | `cosineDistance(@NonNull Expression vector)` Calculates the Cosine distance between this and another vector expressions. |
| `final @NonNull Expression` | `cosineDistance(@NonNull VectorValue vector)` Calculates the Cosine distance between this vector expression and a vector literal. |
| `static final @NonNull Expression` | `cosineDistance(@NonNull Expression vector1, @NonNull double[] vector2)` Calculates the Cosine distance between vector expression and a vector literal. |
| `static final @NonNull Expression` | `cosineDistance(@NonNull Expression vector1, @NonNull Expression vector2)` Calculates the Cosine distance between two vector expressions. |
| `static final @NonNull Expression` | `cosineDistance(@NonNull Expression vector1, @NonNull VectorValue vector2)` Calculates the Cosine distance between vector expression and a vector literal. |
| `static final @NonNull Expression` | `cosineDistance(@NonNull String vectorFieldName, @NonNull double[] vector)` Calculates the Cosine distance between a vector field and a vector literal. |
| `static final @NonNull Expression` | `cosineDistance(@NonNull String vectorFieldName, @NonNull Expression vector)` Calculates the Cosine distance between a vector field and a vector expression. |
| `static final @NonNull Expression` | `cosineDistance( @NonNull String vectorFieldName, @NonNull VectorValue vector )` Calculates the Cosine distance between a vector field and a vector literal. |
| `final @NonNull AggregateFunction` | `count()` Creates an aggregation that counts the number of stage inputs with valid evaluations of the this expression. |
| `final @NonNull AggregateFunction` | `countDistinct()` Creates an aggregation that counts the number of distinct values of an expression across multiple stage inputs. |
| `static final @NonNull Expression` | `currentDocument()` Creates an expression that represents the current document being processed. |
| `static final @NonNull Expression` | `currentTimestamp()` Creates an expression that evaluates to the current server timestamp. |
| `final @NonNull Ordering` | `descending()` Create an `Ordering` that sorts documents in descending order based on value of this expression |
| `final @NonNull Expression` | `divide(@NonNull Expression divisor)` Creates an expression that divides this numeric expression by another numeric expression. |
| `final @NonNull Expression` | `divide(@NonNull Number divisor)` Creates an expression that divides this numeric expression by a constant. |
| `static final @NonNull Expression` | `divide(@NonNull Expression dividend, @NonNull Expression divisor)` Creates an expression that divides two numeric expressions. |
| `static final @NonNull Expression` | `divide(@NonNull Expression dividend, @NonNull Number divisor)` Creates an expression that divides a numeric expression by a constant. |
| `static final @NonNull Expression` | `divide(@NonNull String dividendFieldName, @NonNull Expression divisor)` Creates an expression that divides numeric field by a numeric expression. |
| `static final @NonNull Expression` | `divide(@NonNull String dividendFieldName, @NonNull Number divisor)` Creates an expression that divides a numeric field by a constant. |
| `final @NonNull Expression` | `documentId()` Creates an expression that returns the document ID from this path expression. |
| `static final @NonNull Expression` | `documentId(@NonNull DocumentReference docRef)` Creates an expression that returns the document ID from a `DocumentReference`. |
| `static final @NonNull Expression` | `documentId(@NonNull Expression documentPath)` Creates an expression that returns the document ID from a path. |
| `static final @NonNull Expression` | `documentId(@NonNull String documentPath)` Creates an expression that returns the document ID from a path. |
| `static final @NonNull BooleanExpression` | `documentMatches(@NonNull String rquery)` Perform a full-text search on all indexed search fields in the document. |
| `final @NonNull Expression` | `dotProduct(@NonNull double[] vector)` Calculates the dot product distance between this vector expression and a vector literal. |
| `final @NonNull Expression` | `dotProduct(@NonNull Expression vector)` Calculates the dot product distance between this and another vector expression. |
| `final @NonNull Expression` | `dotProduct(@NonNull VectorValue vector)` Calculates the dot product distance between this vector expression and a vector literal. |
| `static final @NonNull Expression` | `dotProduct(@NonNull Expression vector1, @NonNull double[] vector2)` Calculates the dot product distance between vector expression and a vector literal. |
| `static final @NonNull Expression` | `dotProduct(@NonNull Expression vector1, @NonNull Expression vector2)` Calculates the dot product distance between two vector expressions. |
| `static final @NonNull Expression` | `dotProduct(@NonNull Expression vector1, @NonNull VectorValue vector2)` Calculates the dot product distance between vector expression and a vector literal. |
| `static final @NonNull Expression` | `dotProduct(@NonNull String vectorFieldName, @NonNull double[] vector)` Calculates the dot product distance between vector field and a vector literal. |
| `static final @NonNull Expression` | `dotProduct(@NonNull String vectorFieldName, @NonNull Expression vector)` Calculates the dot product distance between a vector field and a vector expression. |
| `static final @NonNull Expression` | `dotProduct(@NonNull String vectorFieldName, @NonNull VectorValue vector)` Calculates the dot product distance between a vector field and a vector literal. |
| `final @NonNull BooleanExpression` | `endsWith(@NonNull Expression suffix)` Creates an expression that checks if this string expression ends with a given `suffix`. |
| `final @NonNull BooleanExpression` | `endsWith(@NonNull String suffix)` Creates an expression that checks if this string expression ends with a given `suffix`. |
| `static final @NonNull BooleanExpression` | `endsWith(@NonNull String fieldName, @NonNull Expression suffix)` Creates an expression that checks if a string expression ends with a given `suffix`. |
| `static final @NonNull BooleanExpression` | `endsWith(@NonNull String fieldName, @NonNull String suffix)` Creates an expression that checks if a string expression ends with a given `suffix`. |
| `static final @NonNull BooleanExpression` | `endsWith(@NonNull Expression stringExpr, @NonNull Expression suffix)` Creates an expression that checks if a string expression ends with a given `suffix`. |
| `static final @NonNull BooleanExpression` | `endsWith(@NonNull Expression stringExpr, @NonNull String suffix)` Creates an expression that checks if a string expression ends with a given `suffix`. |
| `final @NonNull BooleanExpression` | `equal(@NonNull Expression other)` Creates an expression that checks if this and `other` expression are equal. |
| `final @NonNull BooleanExpression` | `equal(@NonNull Object value)` Creates an expression that checks if this expression is equal to a `value`. |
| `static final @NonNull BooleanExpression` | `equal(@NonNull String fieldName, @NonNull Expression expression)` Creates an expression that checks if a field's value is equal to an expression. |
| `static final @NonNull BooleanExpression` | `equal(@NonNull String fieldName, @NonNull Object value)` Creates an expression that checks if a field's value is equal to another value. |
| `static final @NonNull BooleanExpression` | `equal(@NonNull Expression left, @NonNull Object right)` Creates an expression that checks if an expression is equal to a value. |
| `static final @NonNull BooleanExpression` | `equal(@NonNull Expression left, @NonNull Expression right)` Creates an expression that checks if two expressions are equal. |
| `final @NonNull BooleanExpression` | `equalAny(@NonNull Expression arrayExpression)` Creates an expression that checks if this expression, when evaluated, is equal to any of the elements of `arrayExpression`. |
| `final @NonNull BooleanExpression` | `equalAny(@NonNull List<@NonNull Object> values)` Creates an expression that checks if this expression, when evaluated, is equal to any of the provided `values`. |
| `static final @NonNull BooleanExpression` | `equalAny( @NonNull Expression expression, @NonNull Expression arrayExpression )` Creates an expression that checks if an `expression`, when evaluated, is equal to any of the elements of `arrayExpression`. |
| `static final @NonNull BooleanExpression` | `equalAny( @NonNull Expression expression, @NonNull List<@NonNull Object> values )` Creates an expression that checks if an `expression`, when evaluated, is equal to any of the provided `values`. |
| `static final @NonNull BooleanExpression` | `equalAny(@NonNull String fieldName, @NonNull Expression arrayExpression)` Creates an expression that checks if a field's value is equal to any of the elements of `arrayExpression`. |
| `static final @NonNull BooleanExpression` | `equalAny(@NonNull String fieldName, @NonNull List<@NonNull Object> values)` Creates an expression that checks if a field's value is equal to any of the provided `values` . |
| `final @NonNull Expression` | `euclideanDistance(@NonNull double[] vector)` Calculates the Euclidean distance between this vector expression and a vector literal. |
| `final @NonNull Expression` | `euclideanDistance(@NonNull Expression vector)` Calculates the Euclidean distance between this and another vector expression. |
| `final @NonNull Expression` | `euclideanDistance(@NonNull VectorValue vector)` Calculates the Euclidean distance between this vector expression and a vector literal. |
| `static final @NonNull Expression` | `euclideanDistance(@NonNull Expression vector1, @NonNull double[] vector2)` Calculates the Euclidean distance between vector expression and a vector literal. |
| `static final @NonNull Expression` | `euclideanDistance(@NonNull Expression vector1, @NonNull Expression vector2)` Calculates the Euclidean distance between two vector expressions. |
| `static final @NonNull Expression` | `euclideanDistance( @NonNull Expression vector1, @NonNull VectorValue vector2 )` Calculates the Euclidean distance between vector expression and a vector literal. |
| `static final @NonNull Expression` | `euclideanDistance( @NonNull String vectorFieldName, @NonNull double[] vector )` Calculates the Euclidean distance between a vector field and a vector literal. |
| `static final @NonNull Expression` | `euclideanDistance( @NonNull String vectorFieldName, @NonNull Expression vector )` Calculates the Euclidean distance between a vector field and a vector expression. |
| `static final @NonNull Expression` | `euclideanDistance( @NonNull String vectorFieldName, @NonNull VectorValue vector )` Calculates the Euclidean distance between a vector field and a vector literal. |
| `final @NonNull BooleanExpression` | `exists()` Creates an expression that checks if this expression evaluates to a name of the field that exists. |
| `static final @NonNull BooleanExpression` | `exists(@NonNull String fieldName)` Creates an expression that checks if a field exists. |
| `static final @NonNull BooleanExpression` | `exists(@NonNull Expression value)` Creates an expression that checks if a field exists. |
| `final @NonNull Expression` | `exp()` Creates an expression that returns Euler's number e raised to the power of this expression. |
| `static final @NonNull Expression` | `exp(@NonNull Expression numericExpr)` Creates an expression that returns Euler's number e raised to the power of `numericExpr`. |
| `static final @NonNull Expression` | `exp(@NonNull String numericField)` Creates an expression that returns Euler's number e raised to the power of `numericField`. |
| `static final @NonNull Field` | `field(@NonNull FieldPath fieldPath)` Creates a `Field` instance representing the field at the given path. |
| `static final @NonNull Field` | `field(@NonNull String name)` Creates a `Field` instance representing the field at the given path. |
| `final @NonNull AggregateFunction` | `first()` Creates an aggregation that finds the first value of this expression across multiple stage inputs. |
| `final @NonNull Expression` | `floor()` Creates an expression that returns the largest integer that is not greater than this numeric expression. |
| `static final @NonNull Expression` | `floor(@NonNull Expression numericExpr)` Creates an expression that returns the largest integer that is not greater than `numericExpr` |
| `static final @NonNull Expression` | `floor(@NonNull String numericField)` Creates an expression that returns the largest integer that is not greater than `numericField`. |
| `static final @NonNull Expression` | `geoDistance(@NonNull Field field, @NonNull GeoPoint location)` Evaluates to the distance in meters between the location in the specified field and the query location. |
| `static final @NonNull Expression` | `geoDistance(@NonNull String fieldName, @NonNull GeoPoint location)` Evaluates to the distance in meters between the location in the specified field and the query location. |
| `final @NonNull Expression` | `getField(@NonNull String key)` Accesses a field/property of a document or Map using the provided `key`. |
| `final @NonNull Expression` | `getField(@NonNull Expression keyExpression)` Accesses a field/property of a document or Map using the provided `keyExpression`. |
| `static final @NonNull Expression` | `getField(@NonNull Expression expression, @NonNull String key)` Accesses a field/property of a document or Map using the provided `key`. |
| `static final @NonNull Expression` | `getField(@NonNull Expression expression, @NonNull Expression keyExpression)` Accesses a field/property of a document or Map using the provided `keyExpression`. |
| `static final @NonNull Expression` | `getField(@NonNull String fieldName, @NonNull String key)` Accesses a field/property of a document or Map using the provided `key`. |
| `static final @NonNull Expression` | `getField(@NonNull String fieldName, @NonNull Expression keyExpression)` Accesses a field/property of a document or Map using the provided `keyExpression`. |
| `final @NonNull BooleanExpression` | `greaterThan(@NonNull Expression other)` Creates an expression that checks if this expression is greater than the `other` expression. |
| `final @NonNull BooleanExpression` | `greaterThan(@NonNull Object value)` Creates an expression that checks if this expression is greater than a `value`. |
| `static final @NonNull BooleanExpression` | `greaterThan(@NonNull String fieldName, @NonNull Expression expression)` Creates an expression that checks if a field's value is greater than an expression. |
| `static final @NonNull BooleanExpression` | `greaterThan(@NonNull String fieldName, @NonNull Object value)` Creates an expression that checks if a field's value is greater than another value. |
| `static final @NonNull BooleanExpression` | `greaterThan(@NonNull Expression left, @NonNull Object right)` Creates an expression that checks if an expression is greater than a value. |
| `static final @NonNull BooleanExpression` | `greaterThan(@NonNull Expression left, @NonNull Expression right)` Creates an expression that checks if the first expression is greater than the second expression. |
| `final @NonNull BooleanExpression` | `greaterThanOrEqual(@NonNull Expression other)` Creates an expression that checks if this expression is greater than or equal to the `other` expression. |
| `final @NonNull BooleanExpression` | `greaterThanOrEqual(@NonNull Object value)` Creates an expression that checks if this expression is greater than or equal to a `value`. |
| `static final @NonNull BooleanExpression` | `greaterThanOrEqual( @NonNull String fieldName, @NonNull Expression expression )` Creates an expression that checks if a field's value is greater than or equal to an expression. |
| `static final @NonNull BooleanExpression` | `greaterThanOrEqual(@NonNull String fieldName, @NonNull Object value)` Creates an expression that checks if a field's value is greater than or equal to another value. |
| `static final @NonNull BooleanExpression` | `greaterThanOrEqual(@NonNull Expression left, @NonNull Object right)` Creates an expression that checks if an expression is greater than or equal to a value. |
| `static final @NonNull BooleanExpression` | `greaterThanOrEqual(@NonNull Expression left, @NonNull Expression right)` Creates an expression that checks if the first expression is greater than or equal to the second expression. |
| `final @NonNull Expression` | `ifAbsent(@NonNull Expression elseExpr)` Creates an expression that returns the `elseExpr` argument if this expression is absent, else return the result of this expression. |
| `final @NonNull Expression` | `ifAbsent(@NonNull Object elseValue)` Creates an expression that returns the `elseValue` argument if this expression is absent, else return the result of this expression. |
| `static final @NonNull Expression` | `ifAbsent(@NonNull Expression ifExpr, @NonNull Expression elseExpr)` Creates an expression that returns the `elseExpr` argument if `ifExpr` is absent, else return the result of the `ifExpr` argument evaluation. |
| `static final @NonNull Expression` | `ifAbsent(@NonNull Expression ifExpr, @NonNull Object elseValue)` Creates an expression that returns the `elseValue` argument if `ifExpr` is absent, else return the result of the `ifExpr` argument evaluation. |
| `static final @NonNull Expression` | `ifAbsent(@NonNull String ifFieldName, @NonNull Expression elseExpr)` Creates an expression that returns the `elseExpr` argument if `ifFieldName` is absent, else return the value of the field. |
| `static final @NonNull Expression` | `ifAbsent(@NonNull String ifFieldName, @NonNull Object elseValue)` Creates an expression that returns the `elseValue` argument if `ifFieldName` is absent, else return the value of the field. |
| `final @NonNull Expression` | `ifError(@NonNull Expression catchExpr)` Creates an expression that returns the `catchExpr` argument if there is an error, else return the result of this expression. |
| `final @NonNull Expression` | `ifError(@NonNull Object catchValue)` Creates an expression that returns the `catchValue` argument if there is an error, else return the result of this expression. |
| `static final @NonNull BooleanExpression` | `ifError( @NonNull BooleanExpression tryExpr, @NonNull BooleanExpression catchExpr )` Creates an expression that returns the `catchExpr` argument if there is an error, else return the result of the `tryExpr` argument evaluation. |
| `static final @NonNull Expression` | `ifError(@NonNull Expression tryExpr, @NonNull Expression catchExpr)` Creates an expression that returns the `catchExpr` argument if there is an error, else return the result of the `tryExpr` argument evaluation. |
| `static final @NonNull Expression` | `ifError(@NonNull Expression tryExpr, @NonNull Object catchValue)` Creates an expression that returns the `catchValue` argument if there is an error, else return the result of the `tryExpr` argument evaluation. |
| `final @NonNull Expression` | `ifNull(@NonNull Expression elseExpression)` Creates an expression that returns the `elseExpression` argument if this expression evaluates to null, else return the result of this expression. |
| `final @NonNull Expression` | `ifNull(@NonNull Object elseValue)` Creates an expression that returns the `elseValue` argument if this expression evaluates to null, else return the result of this expression. |
| `static final @NonNull Expression` | `ifNull(@NonNull Expression ifExpr, @NonNull Expression elseExpr)` Creates an expression that returns the `elseExpr` argument if `ifExpr` evaluates to null, else return the result of the `ifExpr` argument evaluation. |
| `static final @NonNull Expression` | `ifNull(@NonNull Expression ifExpr, @NonNull Object elseValue)` Creates an expression that returns the `elseValue` argument if `ifExpr` evaluates to null, else return the result of the `ifExpr` argument evaluation. |
| `static final @NonNull Expression` | `ifNull(@NonNull String ifFieldName, @NonNull Expression elseExpr)` Creates an expression that returns the `elseExpr` argument if `ifFieldName` field is null, else return the value of the field. |
| `static final @NonNull Expression` | `ifNull(@NonNull String ifFieldName, @NonNull Object elseValue)` Creates an expression that returns the `elseValue` argument if `ifFieldName` field is null, else return the value of the field. |
| `final @NonNull BooleanExpression` | `isAbsent()` Creates an expression that returns true if the result of this expression is absent. |
| `static final @NonNull BooleanExpression` | `isAbsent(@NonNull String fieldName)` Creates an expression that returns true if a field is absent. |
| `static final @NonNull BooleanExpression` | `isAbsent(@NonNull Expression value)` Creates an expression that returns true if a value is absent. |
| `final @NonNull BooleanExpression` | `isError()` Creates an expression that checks if this expression produces an error. |
| `static final @NonNull BooleanExpression` | `isError(@NonNull Expression expr)` Creates an expression that checks if a given expression produces an error. |
| `final @NonNull BooleanExpression` | `isType(@NonNull String type)` Creates an expression that checks if the result of this expression is of the given type. |
| `static final @NonNull BooleanExpression` | `isType(@NonNull Expression expr, @NonNull String type)` Creates an expression that checks if the result of an expression is of the given type. |
| `static final @NonNull BooleanExpression` | `isType(@NonNull String fieldName, @NonNull String type)` Creates an expression that checks if the value of a field is of the given type. |
| `final @NonNull Expression` | `join(@NonNull String delimiter)` Creates an expression that joins the elements of an array into a string. |
| `final @NonNull Expression` | `join(@NonNull Expression delimiterExpression)` Creates an expression that joins the elements of an array into a string. |
| `static final @NonNull Expression` | `join(@NonNull Expression arrayExpression, @NonNull String delimiter)` Creates an expression that joins the elements of an array into a string. |
| `static final @NonNull Expression` | `join( @NonNull Expression arrayExpression, @NonNull Expression delimiterExpression )` Creates an expression that joins the elements of an array into a string. |
| `static final @NonNull Expression` | `join(@NonNull String arrayFieldName, @NonNull String delimiter)` Creates an expression that joins the elements of an array field into a string. |
| `static final @NonNull Expression` | `join( @NonNull String arrayFieldName, @NonNull Expression delimiterExpression )` Creates an expression that joins the elements of an array field into a string. |
| `final @NonNull AggregateFunction` | `last()` Creates an aggregation that finds the last value of this expression across multiple stage inputs. |
| `final @NonNull Expression` | `length()` Creates an expression that calculates the length of a string, array, map, vector, or blob expression. |
| `static final @NonNull Expression` | `length(@NonNull Expression expr)` Creates an expression that calculates the length of a string, array, map, vector, or blob expression. |
| `static final @NonNull Expression` | `length(@NonNull String fieldName)` Creates an expression that calculates the length of a string, array, map, vector, or blob field. |
| `final @NonNull BooleanExpression` | `lessThan(@NonNull Expression other)` Creates an expression that checks if this expression is less than the `other` expression. |
| `final @NonNull BooleanExpression` | `lessThan(@NonNull Object value)` Creates an expression that checks if this expression is less than a value. |
| `static final @NonNull BooleanExpression` | `lessThan(@NonNull String fieldName, @NonNull Expression expression)` Creates an expression that checks if a field's value is less than an expression. |
| `static final @NonNull BooleanExpression` | `lessThan(@NonNull String fieldName, @NonNull Object value)` Creates an expression that checks if a field's value is less than another value. |
| `static final @NonNull BooleanExpression` | `lessThan(@NonNull Expression left, @NonNull Object right)` Creates an expression that checks if an expression is less than a value. |
| `static final @NonNull BooleanExpression` | `lessThan(@NonNull Expression left, @NonNull Expression right)` Creates an expression that checks if the first expression is less than the second expression. |
| `final @NonNull BooleanExpression` | `lessThanOrEqual(@NonNull Expression other)` Creates an expression that checks if this expression is less than or equal to the `other` expression. |
| `final @NonNull BooleanExpression` | `lessThanOrEqual(@NonNull Object value)` Creates an expression that checks if this expression is less than or equal to a `value`. |
| `static final @NonNull BooleanExpression` | `lessThanOrEqual(@NonNull String fieldName, @NonNull Expression expression)` Creates an expression that checks if a field's value is less than or equal to an expression. |
| `static final @NonNull BooleanExpression` | `lessThanOrEqual(@NonNull String fieldName, @NonNull Object value)` Creates an expression that checks if a field's value is less than or equal to another value. |
| `static final @NonNull BooleanExpression` | `lessThanOrEqual(@NonNull Expression left, @NonNull Object right)` Creates an expression that checks if an expression is less than or equal to a value. |
| `static final @NonNull BooleanExpression` | `lessThanOrEqual(@NonNull Expression left, @NonNull Expression right)` Creates an expression that checks if the first expression is less than or equal to the second expression. |
| `final @NonNull BooleanExpression` | `like(@NonNull Expression pattern)` Creates an expression that performs a case-sensitive wildcard string comparison. |
| `final @NonNull BooleanExpression` | `like(@NonNull String pattern)` Creates an expression that performs a case-sensitive wildcard string comparison. |
| `static final @NonNull BooleanExpression` | `like(@NonNull String fieldName, @NonNull Expression pattern)` Creates an expression that performs a case-sensitive wildcard string comparison against a field. |
| `static final @NonNull BooleanExpression` | `like(@NonNull String fieldName, @NonNull String pattern)` Creates an expression that performs a case-sensitive wildcard string comparison against a field. |
| `static final @NonNull BooleanExpression` | `like(@NonNull Expression stringExpression, @NonNull Expression pattern)` Creates an expression that performs a case-sensitive wildcard string comparison. |
| `static final @NonNull BooleanExpression` | `like(@NonNull Expression stringExpression, @NonNull String pattern)` Creates an expression that performs a case-sensitive wildcard string comparison. |
| `final @NonNull Expression` | `ln()` Creates an expression that returns the natural logarithm of this numeric expression. |
| `static final @NonNull Expression` | `ln(@NonNull Expression numericExpr)` Creates an expression that returns the natural logarithm (base e) of `numericExpr`. |
| `static final @NonNull Expression` | `ln(@NonNull String numericField)` Creates an expression that returns the natural logarithm (base e) of `numericField`. |
| `static final @NonNull Expression` | `log(@NonNull Expression numericExpr, @NonNull Expression base)` Creates an expression that returns the logarithm of `numericExpr` with a given `base`. |
| `static final @NonNull Expression` | `log(@NonNull Expression numericExpr, @NonNull Number base)` Creates an expression that returns the logarithm of `numericExpr` with a given `base`. |
| `static final @NonNull Expression` | `log(@NonNull String numericField, @NonNull Expression base)` Creates an expression that returns the logarithm of `numericField` with a given `base`. |
| `static final @NonNull Expression` | `log(@NonNull String numericField, @NonNull Number base)` Creates an expression that returns the logarithm of `numericField` with a given `base`. |
| `final @NonNull Expression` | `log10()` Creates an expression that returns the base-10 logarithm of this numeric expression. |
| `static final @NonNull Expression` | `log10(@NonNull Expression numericExpr)` Creates an expression that returns the base 10 logarithm of `numericExpr`. |
| `static final @NonNull Expression` | `log10(@NonNull String numericField)` Creates an expression that returns the base 10 logarithm of `numericField`. |
| `final @NonNull Expression` | `logicalMaximum(@NonNull Object others)` Creates an expression that returns the largest value between multiple input expressions or literal values. |
| `final @NonNull Expression` | `logicalMaximum(@NonNull Expression others)` Creates an expression that returns the largest value between multiple input expressions or literal values. |
| `static final @NonNull Expression` | `logicalMaximum(@NonNull Expression expr, @NonNull Object others)` Creates an expression that returns the largest value between multiple input expressions or literal values. |
| `static final @NonNull Expression` | `logicalMaximum(@NonNull String fieldName, @NonNull Object others)` Creates an expression that returns the largest value between multiple input expressions or literal values. |
| `final @NonNull Expression` | `logicalMinimum(@NonNull Object others)` Creates an expression that returns the smallest value between multiple input expressions or literal values. |
| `final @NonNull Expression` | `logicalMinimum(@NonNull Expression others)` Creates an expression that returns the smallest value between multiple input expressions or literal values. |
| `static final @NonNull Expression` | `logicalMinimum(@NonNull Expression expr, @NonNull Object others)` Creates an expression that returns the smallest value between multiple input expressions or literal values. |
| `static final @NonNull Expression` | `logicalMinimum(@NonNull String fieldName, @NonNull Object others)` Creates an expression that returns the smallest value between multiple input expressions or literal values. |
| `final @NonNull Expression` | `ltrim()` Creates an expression that removes leading whitespace from this string expression. |
| `static final @NonNull Expression` | `ltrim(@NonNull String fieldName)` Creates an expression that removes leading whitespace from a string field. |
| `static final @NonNull Expression` | `ltrim(@NonNull Expression stringExpression)` Creates an expression that removes leading whitespace from a string expression. |
| `final @NonNull Expression` | `ltrimValue(@NonNull Expression valuesToTrim)` Creates an expression that removes a set of leading values from this string expression. |
| `final @NonNull Expression` | `ltrimValue(@NonNull String valuesToTrim)` Creates an expression that removes a set of leading values from this string expression. |
| `static final @NonNull Expression` | `ltrimValue(@NonNull String fieldName, @NonNull Expression valuesToTrim)` Creates an expression that removes specified leading values from a string field. |
| `static final @NonNull Expression` | `ltrimValue(@NonNull String fieldName, @NonNull String valuesToTrim)` Creates an expression that removes specified leading values from a string field. |
| `static final @NonNull Expression` | `ltrimValue( @NonNull Expression stringExpression, @NonNull Expression valuesToTrim )` Creates an expression that removes a set of leading values from a string expression. |
| `static final @NonNull Expression` | `ltrimValue( @NonNull Expression stringExpression, @NonNull String valuesToTrim )` Creates an expression that removes a set of leading values from a string expression. |
| `static final @NonNull Expression` | `map(@NonNull Map<@NonNull String, @NonNull Object> elements)` Creates an expression that creates a Firestore map value from an input object. |
| `final @NonNull Expression` | `mapEntries()` Creates an expression that returns the entries of this map expression as an array of maps, where each map contains a "k" property for the key and a "v" property for the value. |
| `static final @NonNull Expression` | `mapEntries(@NonNull Expression mapExpr)` Creates an expression that returns the entries of a map as an array of maps, where each map contains a "k" property for the key and a "v" property for the value. |
| `static final @NonNull Expression` | `mapEntries(@NonNull String mapField)` Creates an expression that returns the entries of a map as an array of maps. |
| `final @NonNull Expression` | `mapGet(@NonNull String key)` Accesses a map (object) value using the provided `key`. |
| `final @NonNull Expression` | `mapGet(@NonNull Expression keyExpression)` Accesses a map (object) value using the provided `keyExpression`. |
| `static final @NonNull Expression` | `mapGet(@NonNull String fieldName, @NonNull String key)` Accesses a value from a map (object) field using the provided `key`. |
| `static final @NonNull Expression` | `mapGet(@NonNull String fieldName, @NonNull Expression keyExpression)` Accesses a value from a map (object) field using the provided `keyExpression`. |
| `static final @NonNull Expression` | `mapGet(@NonNull Expression mapExpression, @NonNull String key)` Accesses a value from a map (object) field using the provided `key`. |
| `static final @NonNull Expression` | `mapGet( @NonNull Expression mapExpression, @NonNull Expression keyExpression )` Accesses a value from a map (object) field using the provided `keyExpression`. |
| `final @NonNull Expression` | `mapKeys()` Creates an expression that returns the keys of this map expression. |
| `static final @NonNull Expression` | `mapKeys(@NonNull Expression mapExpr)` Creates an expression that returns the keys of a map. |
| `static final @NonNull Expression` | `mapKeys(@NonNull String mapField)` Creates an expression that returns the keys of a map. |
| `final @NonNull Expression` | `mapMerge(@NonNull Expression mapExpr, @NonNull Expression otherMaps)` Creates an expression that merges multiple maps into a single map. |
| `static final @NonNull Expression` | `mapMerge( @NonNull Expression firstMap, @NonNull Expression secondMap, @NonNull Expression otherMaps )` Creates an expression that merges multiple maps into a single map. |
| `static final @NonNull Expression` | `mapMerge( @NonNull String firstMapFieldName, @NonNull Expression secondMap, @NonNull Expression otherMaps )` Creates an expression that merges multiple maps into a single map. |
| `final @NonNull Expression` | `mapRemove(@NonNull String key)` Creates an expression that removes a key from this map expression. |
| `final @NonNull Expression` | `mapRemove(@NonNull Expression keyExpression)` Creates an expression that removes a key from this map expression. |
| `static final @NonNull Expression` | `mapRemove(@NonNull Expression mapExpr, @NonNull Expression key)` Creates an expression that removes a key from the map produced by evaluating an expression. |
| `static final @NonNull Expression` | `mapRemove(@NonNull Expression mapExpr, @NonNull String key)` Creates an expression that removes a key from the map produced by evaluating an expression. |
| `static final @NonNull Expression` | `mapRemove(@NonNull String mapField, @NonNull Expression key)` Creates an expression that removes a key from the map produced by evaluating an expression. |
| `static final @NonNull Expression` | `mapRemove(@NonNull String mapField, @NonNull String key)` Creates an expression that removes a key from the map produced by evaluating an expression. |
| `final @NonNull Expression` | `mapSet( @NonNull Expression key, @NonNull Expression value, @NonNull Expression moreKeyValues )` Creates an expression that returns a new map with the specified entries added or updated. |
| `final @NonNull Expression` | `mapSet(@NonNull String key, Object value, @NonNull Object moreKeyValues)` Creates an expression that returns a new map with the specified entries added or updated. |
| `static final @NonNull Expression` | `mapSet( @NonNull Expression mapExpr, @NonNull Expression key, @NonNull Expression value, @NonNull Expression moreKeyValues )` Creates an expression that returns a new map with the specified entries added or updated. |
| `static final @NonNull Expression` | `mapSet( @NonNull Expression mapExpr, @NonNull String key, Object value, @NonNull Object moreKeyValues )` Creates an expression that returns a new map with the specified entries added or updated. |
| `static final @NonNull Expression` | `mapSet( @NonNull String mapField, @NonNull Expression key, @NonNull Expression value, @NonNull Expression moreKeyValues )` Creates an expression that returns a new map with the specified entries added or updated. |
| `static final @NonNull Expression` | `mapSet( @NonNull String mapField, @NonNull String key, Object value, @NonNull Object moreKeyValues )` Creates an expression that returns a new map with the specified entries added or updated. |
| `final @NonNull Expression` | `mapValues()` Creates an expression that returns the values of this map expression. |
| `static final @NonNull Expression` | `mapValues(@NonNull Expression mapExpr)` Creates an expression that returns the values of a map. |
| `static final @NonNull Expression` | `mapValues(@NonNull String mapField)` Creates an expression that returns the values of a map. |
| `final @NonNull AggregateFunction` | `maximum()` Creates an aggregation that finds the maximum value of this expression across multiple stage inputs. |
| `final @NonNull AggregateFunction` | `minimum()` Creates an aggregation that finds the minimum value of this expression across multiple stage inputs. |
| `final @NonNull Expression` | `mod(@NonNull Expression divisor)` Creates an expression that calculates the modulo (remainder) of dividing this numeric expressions by another numeric expression. |
| `final @NonNull Expression` | `mod(@NonNull Number divisor)` Creates an expression that calculates the modulo (remainder) of dividing this numeric expressions by a constant. |
| `static final @NonNull Expression` | `mod(@NonNull Expression dividend, @NonNull Expression divisor)` Creates an expression that calculates the modulo (remainder) of dividing two numeric expressions. |
| `static final @NonNull Expression` | `mod(@NonNull Expression dividend, @NonNull Number divisor)` Creates an expression that calculates the modulo (remainder) of dividing a numeric expression by a constant. |
| `static final @NonNull Expression` | `mod(@NonNull String dividendFieldName, @NonNull Expression divisor)` Creates an expression that calculates the modulo (remainder) of dividing a numeric field by a constant. |
| `static final @NonNull Expression` | `mod(@NonNull String dividendFieldName, @NonNull Number divisor)` Creates an expression that calculates the modulo (remainder) of dividing a numeric field by a constant. |
| `final @NonNull Expression` | `multiply(@NonNull Expression second)` Creates an expression that multiplies this numeric expression with another numeric expression. |
| `final @NonNull Expression` | `multiply(@NonNull Number second)` Creates an expression that multiplies this numeric expression with a constant. |
| `static final @NonNull Expression` | `multiply(@NonNull Expression first, @NonNull Expression second)` Creates an expression that multiplies numeric expressions. |
| `static final @NonNull Expression` | `multiply(@NonNull Expression first, @NonNull Number second)` Creates an expression that multiplies numeric expressions with a constant. |
| `static final @NonNull Expression` | `multiply(@NonNull String numericFieldName, @NonNull Expression second)` Creates an expression that multiplies a numeric field with a numeric expression. |
| `static final @NonNull Expression` | `multiply(@NonNull String numericFieldName, @NonNull Number second)` Creates an expression that multiplies a numeric field with a constant. |
| `static final @NonNull BooleanExpression` | `nor( @NonNull BooleanExpression condition, @NonNull BooleanExpression conditions )` Creates an expression that performs a logical 'NOR' operation. |
| `static final @NonNull BooleanExpression` | `not(@NonNull BooleanExpression condition)` Creates an expression that negates a boolean expression. |
| `final @NonNull BooleanExpression` | `notEqual(@NonNull Expression other)` Creates an expression that checks if this expressions is not equal to the `other` expression. |
| `final @NonNull BooleanExpression` | `notEqual(@NonNull Object value)` Creates an expression that checks if this expression is not equal to a `value`. |
| `static final @NonNull BooleanExpression` | `notEqual(@NonNull String fieldName, @NonNull Expression expression)` Creates an expression that checks if a field's value is not equal to an expression. |
| `static final @NonNull BooleanExpression` | `notEqual(@NonNull String fieldName, @NonNull Object value)` Creates an expression that checks if a field's value is not equal to another value. |
| `static final @NonNull BooleanExpression` | `notEqual(@NonNull Expression left, @NonNull Object right)` Creates an expression that checks if an expression is not equal to a value. |
| `static final @NonNull BooleanExpression` | `notEqual(@NonNull Expression left, @NonNull Expression right)` Creates an expression that checks if two expressions are not equal. |
| `final @NonNull BooleanExpression` | `notEqualAny(@NonNull Expression arrayExpression)` Creates an expression that checks if this expression, when evaluated, is not equal to all the elements of `arrayExpression`. |
| `final @NonNull BooleanExpression` | `notEqualAny(@NonNull List<@NonNull Object> values)` Creates an expression that checks if this expression, when evaluated, is not equal to all the provided `values`. |
| `static final @NonNull BooleanExpression` | `notEqualAny( @NonNull Expression expression, @NonNull Expression arrayExpression )` Creates an expression that checks if an `expression`, when evaluated, is not equal to all the elements of `arrayExpression`. |
| `static final @NonNull BooleanExpression` | `notEqualAny( @NonNull Expression expression, @NonNull List<@NonNull Object> values )` Creates an expression that checks if an `expression`, when evaluated, is not equal to all the provided `values`. |
| `static final @NonNull BooleanExpression` | `notEqualAny(@NonNull String fieldName, @NonNull Expression arrayExpression)` Creates an expression that checks if a field's value is not equal to all of the elements of `arrayExpression`. |
| `static final @NonNull BooleanExpression` | `notEqualAny(@NonNull String fieldName, @NonNull List<@NonNull Object> values)` Creates an expression that checks if a field's value is not equal to all of the provided `values`. |
| `static final @NonNull Expression` | `nullValue()` Constant for a null value. |
| `static final @NonNull BooleanExpression` | `or( @NonNull BooleanExpression condition, @NonNull BooleanExpression conditions )` Creates an expression that performs a logical 'OR' operation. |
| `final @NonNull Expression` | `parent()` Creates an expression that returns the parent document reference of this document reference expression. |
| `static final @NonNull Expression` | `parent(@NonNull DocumentReference docRef)` Creates an expression that returns the parent document reference of a document reference. |
| `static final @NonNull Expression` | `parent(@NonNull Expression documentPath)` Creates an expression that returns the parent document reference of a document reference. |
| `static final @NonNull Expression` | `parent(@NonNull String documentPath)` Creates an expression that returns the parent document reference of a document reference. |
| `final @NonNull Expression` | `pow(@NonNull Expression exponent)` Creates an expression that returns this numeric expression raised to the power of the `exponent`. |
| `final @NonNull Expression` | `pow(@NonNull Number exponent)` Creates an expression that returns this numeric expression raised to the power of the `exponent`. |
| `static final @NonNull Expression` | `pow(@NonNull Expression numericExpr, @NonNull Expression exponent)` Creates an expression that returns the `numericExpr` raised to the power of the `exponent`. |
| `static final @NonNull Expression` | `pow(@NonNull Expression numericExpr, @NonNull Number exponent)` Creates an expression that returns the `numericExpr` raised to the power of the `exponent`. |
| `static final @NonNull Expression` | `pow(@NonNull String numericField, @NonNull Expression exponent)` Creates an expression that returns the `numericField` raised to the power of the `exponent`. |
| `static final @NonNull Expression` | `pow(@NonNull String numericField, @NonNull Number exponent)` Creates an expression that returns the `numericField` raised to the power of the `exponent`. |
| `static final @NonNull Expression` | `rand()` Creates an expression that returns a pseudo-random number of type double in the range of \[0, 1), inclusive of 0 and exclusive of 1. |
| `static final @NonNull Expression` | `rawFunction(@NonNull String name, @NonNull Expression expr)` Creates a 'raw' function expression. |
| `final @NonNull BooleanExpression` | `regexContains(@NonNull Expression pattern)` Creates an expression that checks if this string expression contains a specified regular expression as a substring. |
| `final @NonNull BooleanExpression` | `regexContains(@NonNull String pattern)` Creates an expression that checks if this string expression contains a specified regular expression as a substring. |
| `static final @NonNull BooleanExpression` | `regexContains(@NonNull String fieldName, @NonNull Expression pattern)` Creates an expression that checks if a string field contains a specified regular expression as a substring. |
| `static final @NonNull BooleanExpression` | `regexContains(@NonNull String fieldName, @NonNull String pattern)` Creates an expression that checks if a string field contains a specified regular expression as a substring. |
| `static final @NonNull BooleanExpression` | `regexContains( @NonNull Expression stringExpression, @NonNull Expression pattern )` Creates an expression that checks if a string expression contains a specified regular expression as a substring. |
| `static final @NonNull BooleanExpression` | `regexContains( @NonNull Expression stringExpression, @NonNull String pattern )` Creates an expression that checks if a string expression contains a specified regular expression as a substring. |
| `static final @NonNull Expression` | `regexFind(@NonNull String fieldName, @NonNull Expression pattern)` Creates an expression that returns the first substring of a string field that matches a specified regular expression. |
| `static final @NonNull Expression` | `regexFind(@NonNull String fieldName, @NonNull String pattern)` Creates an expression that returns the first substring of a string field that matches a specified regular expression. |
| `static final @NonNull Expression` | `regexFind( @NonNull Expression stringExpression, @NonNull Expression pattern )` Creates an expression that returns the first substring of a string expression that matches a specified regular expression. |
| `static final @NonNull Expression` | `regexFind(@NonNull Expression stringExpression, @NonNull String pattern)` Creates an expression that returns the first substring of a string expression that matches a specified regular expression. |
| `static final @NonNull Expression` | `regexFindAll(@NonNull String fieldName, @NonNull Expression pattern)` Creates an expression that evaluates to a list of all substrings in a string field that match a specified regular expression. |
| `static final @NonNull Expression` | `regexFindAll(@NonNull String fieldName, @NonNull String pattern)` Creates an expression that evaluates to a list of all substrings in a string field that match a specified regular expression. |
| `static final @NonNull Expression` | `regexFindAll( @NonNull Expression stringExpression, @NonNull Expression pattern )` Creates an expression that evaluates to a list of all substrings in a string expression that match a specified regular expression. |
| `static final @NonNull Expression` | `regexFindAll(@NonNull Expression stringExpression, @NonNull String pattern)` Creates an expression that evaluates to a list of all substrings in a string expression that match a specified regular expression. |
| `final @NonNull BooleanExpression` | `regexMatch(@NonNull Expression pattern)` Creates an expression that checks if this string expression matches a specified regular expression. |
| `final @NonNull BooleanExpression` | `regexMatch(@NonNull String pattern)` Creates an expression that checks if this string expression matches a specified regular expression. |
| `static final @NonNull BooleanExpression` | `regexMatch(@NonNull String fieldName, @NonNull Expression pattern)` Creates an expression that checks if a string field matches a specified regular expression. |
| `static final @NonNull BooleanExpression` | `regexMatch(@NonNull String fieldName, @NonNull String pattern)` Creates an expression that checks if a string field matches a specified regular expression. |
| `static final @NonNull BooleanExpression` | `regexMatch( @NonNull Expression stringExpression, @NonNull Expression pattern )` Creates an expression that checks if a string field matches a specified regular expression. |
| `static final @NonNull BooleanExpression` | `regexMatch(@NonNull Expression stringExpression, @NonNull String pattern)` Creates an expression that checks if a string field matches a specified regular expression. |
| `final @NonNull Expression` | `reverse()` Creates an expression that reverses this string expression. |
| `static final @NonNull Expression` | `reverse(@NonNull String fieldName)` Creates an expression that reverses a string value from the specified field. |
| `static final @NonNull Expression` | `reverse(@NonNull Expression stringExpression)` Creates an expression that reverses a string. |
| `final @NonNull Expression` | `round()` Creates an expression that rounds this numeric expression to nearest integer. |
| `static final @NonNull Expression` | `round(@NonNull Expression numericExpr)` Creates an expression that rounds `numericExpr` to nearest integer. |
| `static final @NonNull Expression` | `round(@NonNull String numericField)` Creates an expression that rounds `numericField` to nearest integer. |
| `final @NonNull Expression` | `roundToPrecision(@NonNull 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. |
| `final @NonNull 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. |
| `static final @NonNull Expression` | `roundToPrecision( @NonNull Expression numericExpr, @NonNull 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. |
| `static final @NonNull Expression` | `roundToPrecision(@NonNull 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. |
| `static final @NonNull Expression` | `roundToPrecision( @NonNull String numericField, @NonNull 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. |
| `static final @NonNull Expression` | `roundToPrecision(@NonNull 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. |
| `final @NonNull Expression` | `rtrim()` Creates an expression that removes trailing whitespace from this string expression. |
| `static final @NonNull Expression` | `rtrim(@NonNull String fieldName)` Creates an expression that removes trailing whitespace from a string field. |
| `static final @NonNull Expression` | `rtrim(@NonNull Expression stringExpression)` Creates an expression that removes trailing whitespace from a string expression. |
| `final @NonNull Expression` | `rtrimValue(@NonNull Expression valuesToTrim)` Creates an expression that removes a set of trailing values from this string expression. |
| `final @NonNull Expression` | `rtrimValue(@NonNull String valuesToTrim)` Creates an expression that removes a set of trailing characters from this string expression. |
| `static final @NonNull Expression` | `rtrimValue(@NonNull String fieldName, @NonNull Expression valuesToTrim)` Creates an expression that removes a set of trailing values from a string field. |
| `static final @NonNull Expression` | `rtrimValue(@NonNull String fieldName, @NonNull String valuesToTrim)` Creates an expression that removes a set of trailing values from a string field. |
| `static final @NonNull Expression` | `rtrimValue( @NonNull Expression stringExpression, @NonNull Expression valuesToTrim )` Creates an expression that removes a set of trailing values from a string expression. |
| `static final @NonNull Expression` | `rtrimValue( @NonNull Expression stringExpression, @NonNull String valuesToTrim )` Creates an expression that removes a set of trailing values from a string expression. |
| `static final @NonNull Expression` | `score()` Evaluates to the search score that reflects the topicality of the document to all of the text predicates (for example: `documentMatches`) in the search query. |
| `final @NonNull Expression` | `split(@NonNull Blob delimiter)` Creates an expression that splits this blob expression by a blob delimiter. |
| `final @NonNull Expression` | `split(@NonNull Expression delimiter)` Creates an expression that splits this string or blob expression by a delimiter. |
| `final @NonNull Expression` | `split(@NonNull String delimiter)` Creates an expression that splits this string or blob expression by a string delimiter. |
| `static final @NonNull Expression` | `split(@NonNull String fieldName, @NonNull Blob delimiter)` Creates an expression that splits a blob field by a blob delimiter. |
| `static final @NonNull Expression` | `split(@NonNull String fieldName, @NonNull Expression delimiter)` Creates an expression that splits a string or blob field by a delimiter. |
| `static final @NonNull Expression` | `split(@NonNull String fieldName, @NonNull String delimiter)` Creates an expression that splits a string or blob field by a string delimiter. |
| `static final @NonNull Expression` | `split(@NonNull Expression value, @NonNull Blob delimiter)` Creates an expression that splits a blob by a blob delimiter. |
| `static final @NonNull Expression` | `split(@NonNull Expression value, @NonNull Expression delimiter)` Creates an expression that splits a string or blob by a delimiter. |
| `static final @NonNull Expression` | `split(@NonNull Expression value, @NonNull String delimiter)` Creates an expression that splits a string or blob by a string delimiter. |
| `final @NonNull Expression` | `sqrt()` Creates an expression that returns the square root of this numeric expression. |
| `static final @NonNull Expression` | `sqrt(@NonNull Expression numericExpr)` Creates an expression that returns the square root of `numericExpr`. |
| `static final @NonNull Expression` | `sqrt(@NonNull String numericField)` Creates an expression that returns the square root of `numericField`. |
| `final @NonNull BooleanExpression` | `startsWith(@NonNull Expression prefix)` Creates an expression that checks if this string expression starts with a given `prefix`. |
| `final @NonNull BooleanExpression` | `startsWith(@NonNull String prefix)` Creates an expression that checks if this string expression starts with a given `prefix`. |
| `static final @NonNull BooleanExpression` | `startsWith(@NonNull String fieldName, @NonNull Expression prefix)` Creates an expression that checks if a string expression starts with a given `prefix`. |
| `static final @NonNull BooleanExpression` | `startsWith(@NonNull String fieldName, @NonNull String prefix)` Creates an expression that checks if a string expression starts with a given `prefix`. |
| `static final @NonNull BooleanExpression` | `startsWith(@NonNull Expression stringExpr, @NonNull Expression prefix)` ``` // Check if the 'fullName' field starts with the value of the 'firstName' field startsWith(field("fullName"), field("firstName")) ``` |
| `static final @NonNull BooleanExpression` | `startsWith(@NonNull Expression stringExpr, @NonNull String prefix)` Creates an expression that checks if a string expression starts with a given `prefix`. |
| `final @NonNull Expression` | `stringConcat(@NonNull Expression stringExpressions)` Creates an expression that concatenates string expressions together. |
| `final @NonNull Expression` | `stringConcat(@NonNull Object strings)` Creates an expression that concatenates string expressions and string constants together. |
| `final @NonNull Expression` | `stringConcat(@NonNull String strings)` Creates an expression that concatenates this string expression with string constants. |
| `static final @NonNull Expression` | `stringConcat(@NonNull String fieldName, @NonNull Object otherStrings)` Creates an expression that concatenates string expressions together. |
| `static final @NonNull Expression` | `stringConcat(@NonNull String fieldName, @NonNull Expression otherStrings)` Creates an expression that concatenates string expressions together. |
| `static final @NonNull Expression` | `stringConcat(@NonNull Expression firstString, @NonNull Object otherStrings)` Creates an expression that concatenates string expressions together. |
| `static final @NonNull Expression` | `stringConcat( @NonNull Expression firstString, @NonNull Expression otherStrings )` Creates an expression that concatenates string expressions together. |
| `final @NonNull BooleanExpression` | `stringContains(@NonNull Expression substring)` Creates an expression that checks if this string expression contains a specified substring. |
| `final @NonNull BooleanExpression` | `stringContains(@NonNull String substring)` Creates an expression that checks if this string expression contains a specified substring. |
| `static final @NonNull BooleanExpression` | `stringContains(@NonNull String fieldName, @NonNull Expression substring)` Creates an expression that checks if a string field contains a specified substring. |
| `static final @NonNull BooleanExpression` | `stringContains(@NonNull String fieldName, @NonNull String substring)` Creates an expression that checks if a string field contains a specified substring. |
| `static final @NonNull BooleanExpression` | `stringContains( @NonNull Expression stringExpression, @NonNull Expression substring )` Creates an expression that checks if a string expression contains a specified substring. |
| `static final @NonNull BooleanExpression` | `stringContains( @NonNull Expression stringExpression, @NonNull String substring )` Creates an expression that checks if a string expression contains a specified substring. |
| `final @NonNull Expression` | `stringIndexOf(@NonNull Expression substring)` Creates an expression that returns the 0-based index of the first occurrence of the specified substring. |
| `final @NonNull Expression` | `stringIndexOf(@NonNull String substring)` Creates an expression that returns the 0-based index of the first occurrence of the specified substring. |
| `static final @NonNull Expression` | `stringIndexOf(@NonNull String fieldName, @NonNull Expression substring)` Creates an expression that returns the 0-based index of the first occurrence of the specified substring in a field. |
| `static final @NonNull Expression` | `stringIndexOf(@NonNull String fieldName, @NonNull String substring)` Creates an expression that returns the 0-based index of the first occurrence of the specified substring in a field. |
| `static final @NonNull Expression` | `stringIndexOf( @NonNull Expression stringExpression, @NonNull Expression substring )` Creates an expression that returns the 0-based index of the first occurrence of the specified substring. |
| `static final @NonNull Expression` | `stringIndexOf( @NonNull Expression stringExpression, @NonNull String substring )` Creates an expression that returns the 0-based index of the first occurrence of the specified substring. |
| `final @NonNull Expression` | `stringRepeat(@NonNull Expression count)` Creates an expression that repeats this string expression a given number of times. |
| `final @NonNull Expression` | `stringRepeat(int count)` Creates an expression that repeats this string expression a given number of times. |
| `static final @NonNull Expression` | `stringRepeat(@NonNull String fieldName, @NonNull Expression count)` Creates an expression that repeats a string field a given number of times. |
| `static final @NonNull Expression` | `stringRepeat(@NonNull String fieldName, int count)` Creates an expression that repeats a string field a given number of times. |
| `static final @NonNull Expression` | `stringRepeat( @NonNull Expression stringExpression, @NonNull Expression count )` Creates an expression that repeats a string expression a given number of times. |
| `static final @NonNull Expression` | `stringRepeat(@NonNull Expression stringExpression, int count)` Creates an expression that repeats a string expression a given number of times. |
| `final @NonNull Expression` | `stringReplaceAll( @NonNull Expression oldValue, @NonNull Expression newValue )` Creates an expression that replaces all occurrences of a substring with another string. |
| `final @NonNull Expression` | `stringReplaceAll(@NonNull String oldValue, @NonNull String newValue)` Creates an expression that replaces all occurrences of a substring with another string. |
| `static final @NonNull Expression` | `stringReplaceAll( @NonNull String fieldName, @NonNull Expression oldValue, @NonNull Expression newValue )` Creates an expression that replaces all occurrences of a substring with another string in a field. |
| `static final @NonNull Expression` | `stringReplaceAll( @NonNull String fieldName, @NonNull String oldValue, @NonNull String newValue )` Creates an expression that replaces all occurrences of a substring with another string in a field. |
| `static final @NonNull Expression` | `stringReplaceAll( @NonNull Expression stringExpression, @NonNull Expression oldValue, @NonNull Expression newValue )` Creates an expression that replaces all occurrences of a substring with another string. |
| `static final @NonNull Expression` | `stringReplaceAll( @NonNull Expression stringExpression, @NonNull String oldValue, @NonNull String newValue )` Creates an expression that replaces all occurrences of a substring with another string. |
| `final @NonNull Expression` | `stringReplaceOne( @NonNull Expression oldValue, @NonNull Expression newValue )` Creates an expression that replaces the first occurrence of a substring with another string. |
| `final @NonNull Expression` | `stringReplaceOne(@NonNull String oldValue, @NonNull String newValue)` Creates an expression that replaces the first occurrence of a substring with another string. |
| `static final @NonNull Expression` | `stringReplaceOne( @NonNull String fieldName, @NonNull Expression oldValue, @NonNull Expression newValue )` Creates an expression that replaces the first occurrence of a substring with another string in a field. |
| `static final @NonNull Expression` | `stringReplaceOne( @NonNull String fieldName, @NonNull String oldValue, @NonNull String newValue )` Creates an expression that replaces the first occurrence of a substring with another string in a field. |
| `static final @NonNull Expression` | `stringReplaceOne( @NonNull Expression stringExpression, @NonNull Expression oldValue, @NonNull Expression newValue )` Creates an expression that replaces the first occurrence of a substring with another string. |
| `static final @NonNull Expression` | `stringReplaceOne( @NonNull Expression stringExpression, @NonNull String oldValue, @NonNull String newValue )` Creates an expression that replaces the first occurrence of a substring with another string. |
| `final @NonNull Expression` | `stringReverse()` Creates an expression that performs a reverse operation on this string expression. |
| `static final @NonNull Expression` | `stringReverse(@NonNull String fieldName)` Reverses the given string field. |
| `static final @NonNull Expression` | `stringReverse(@NonNull Expression str)` Reverses the given string expression. |
| `final @NonNull Expression` | `substring(@NonNull Expression start, @NonNull Expression length)` Creates an expression that returns a substring of the given string. |
| `final @NonNull Expression` | `substring(int start, int length)` Creates an expression that returns a substring of the given string. |
| `static final @NonNull Expression` | `substring(@NonNull String fieldName, int index, int length)` Creates an expression that returns a substring of the given string. |
| `static final @NonNull Expression` | `substring( @NonNull Expression stringExpression, @NonNull Expression index, @NonNull Expression length )` Creates an expression that returns a substring of the given string. |
| `final @NonNull Expression` | `subtract(@NonNull Expression subtrahend)` Creates an expression that subtracts a constant from this numeric expression. |
| `final @NonNull Expression` | `subtract(@NonNull Number subtrahend)` Creates an expression that subtracts a numeric expressions from this numeric expression. |
| `static final @NonNull Expression` | `subtract(@NonNull Expression minuend, @NonNull Expression subtrahend)` Creates an expression that subtracts two expressions. |
| `static final @NonNull Expression` | `subtract(@NonNull Expression minuend, @NonNull Number subtrahend)` Creates an expression that subtracts a constant value from a numeric expression. |
| `static final @NonNull Expression` | `subtract(@NonNull String numericFieldName, @NonNull Expression subtrahend)` Creates an expression that subtracts a numeric expressions from numeric field. |
| `static final @NonNull Expression` | `subtract(@NonNull String numericFieldName, @NonNull Number subtrahend)` Creates an expression that subtracts a constant from numeric field. |
| `final @NonNull AggregateFunction` | `sum()` Creates an aggregation that calculates the sum of this numeric expression across multiple stage inputs. |
| `static final @NonNull Expression` | `switchOn( @NonNull BooleanExpression condition, @NonNull Object result, @NonNull Object others )` Creates an expression that evaluates to the result corresponding to the first true condition. |
| `final @NonNull Expression` | `timestampAdd(@NonNull Expression unit, @NonNull Expression amount)` Creates an expression that adds a specified amount of time to this timestamp expression. |
| `final @NonNull Expression` | `timestampAdd(@NonNull String unit, long amount)` Creates an expression that adds a specified amount of time to this timestamp expression. |
| `static final @NonNull Expression` | `timestampAdd( @NonNull String fieldName, @NonNull Expression unit, @NonNull Expression amount )` Creates an expression that adds a specified amount of time to a timestamp. |
| `static final @NonNull Expression` | `timestampAdd(@NonNull String fieldName, @NonNull String unit, long amount)` Creates an expression that adds a specified amount of time to a timestamp. |
| `static final @NonNull Expression` | `timestampAdd( @NonNull Expression timestamp, @NonNull Expression unit, @NonNull Expression amount )` Creates an expression that adds a specified amount of time to a timestamp. |
| `static final @NonNull Expression` | `timestampAdd( @NonNull Expression timestamp, @NonNull String unit, long amount )` Creates an expression that adds a specified amount of time to a timestamp. |
| `final @NonNull Expression` | `timestampDiff(@NonNull Expression start, @NonNull Expression unit)` Calculates the difference between this timestamp and another timestamp. |
| `final @NonNull Expression` | `timestampDiff(@NonNull Expression start, @NonNull String unit)` Calculates the difference between this timestamp and another timestamp. |
| `final @NonNull Expression` | `timestampDiff(@NonNull String startFieldName, @NonNull String unit)` Calculates the difference between this timestamp and another timestamp. |
| `static final @NonNull Expression` | `timestampDiff( @NonNull Expression end, @NonNull Expression start, @NonNull Expression unit )` Creates an expression that calculates the difference between two timestamps. |
| `static final @NonNull Expression` | `timestampDiff( @NonNull Expression end, @NonNull Expression start, @NonNull String unit )` Creates an expression that calculates the difference between two timestamps. |
| `static final @NonNull Expression` | `timestampDiff( @NonNull Expression end, @NonNull String startFieldName, @NonNull String unit )` Creates an expression that calculates the difference between two timestamps. |
| `static final @NonNull Expression` | `timestampDiff( @NonNull String endFieldName, @NonNull Expression start, @NonNull String unit )` Creates an expression that calculates the difference between two timestamps. |
| `static final @NonNull Expression` | `timestampDiff( @NonNull String endFieldName, @NonNull String startFieldName, @NonNull String unit )` Creates an expression that calculates the difference between two timestamps. |
| `final @NonNull Expression` | `timestampExtract(@NonNull Expression part)` Creates an expression that extracts a specified part from this timestamp expression. |
| `final @NonNull Expression` | `timestampExtract(@NonNull String part)` Creates an expression that extracts a specified part from this timestamp expression. |
| `static final @NonNull Expression` | `timestampExtract(@NonNull String fieldName, @NonNull Expression part)` Creates an expression that extracts a specified part from a timestamp. |
| `static final @NonNull Expression` | `timestampExtract(@NonNull String fieldName, @NonNull String part)` Creates an expression that extracts a specified part from a timestamp. |
| `static final @NonNull Expression` | `timestampExtract(@NonNull Expression timestamp, @NonNull Expression part)` Creates an expression that extracts a specified part from a timestamp. |
| `static final @NonNull Expression` | `timestampExtract(@NonNull Expression timestamp, @NonNull String part)` Creates an expression that extracts a specified part from a timestamp. |
| `final @NonNull Expression` | `timestampExtractWithTimezone( @NonNull Expression part, @NonNull Expression timezone )` Creates an expression that extracts a specified part from this timestamp expression in a given timezone. |
| `final @NonNull Expression` | `timestampExtractWithTimezone( @NonNull Expression part, @NonNull String timezone )` Creates an expression that extracts a specified part from this timestamp expression in a given timezone. |
| `final @NonNull Expression` | `timestampExtractWithTimezone( @NonNull String part, @NonNull Expression timezone )` Creates an expression that extracts a specified part from this timestamp expression in a given timezone. |
| `final @NonNull Expression` | `timestampExtractWithTimezone( @NonNull String part, @NonNull String timezone )` Creates an expression that extracts a specified part from this timestamp expression in a given timezone. |
| `static final @NonNull Expression` | `timestampExtractWithTimezone( @NonNull String fieldName, @NonNull Expression part, @NonNull Expression timezone )` Creates an expression that extracts a specified part from a timestamp in a given timezone. |
| `static final @NonNull Expression` | `timestampExtractWithTimezone( @NonNull String fieldName, @NonNull Expression part, @NonNull String timezone )` Creates an expression that extracts a specified part from a timestamp in a given timezone. |
| `static final @NonNull Expression` | `timestampExtractWithTimezone( @NonNull String fieldName, @NonNull String part, @NonNull Expression timezone )` Creates an expression that extracts a specified part from a timestamp in a given timezone. |
| `static final @NonNull Expression` | `timestampExtractWithTimezone( @NonNull String fieldName, @NonNull String part, @NonNull String timezone )` Creates an expression that extracts a specified part from a timestamp in a given timezone. |
| `static final @NonNull Expression` | `timestampExtractWithTimezone( @NonNull Expression timestamp, @NonNull Expression part, @NonNull Expression timezone )` Creates an expression that extracts a specified part from a timestamp in a given timezone. |
| `static final @NonNull Expression` | `timestampExtractWithTimezone( @NonNull Expression timestamp, @NonNull Expression part, @NonNull String timezone )` Creates an expression that extracts a specified part from a timestamp in a given timezone. |
| `static final @NonNull Expression` | `timestampExtractWithTimezone( @NonNull Expression timestamp, @NonNull String part, @NonNull Expression timezone )` Creates an expression that extracts a specified part from a timestamp in a given timezone. |
| `static final @NonNull Expression` | `timestampExtractWithTimezone( @NonNull Expression timestamp, @NonNull String part, @NonNull String timezone )` Creates an expression that extracts a specified part from a timestamp in a given timezone. |
| `final @NonNull Expression` | `timestampSubtract(@NonNull Expression unit, @NonNull Expression amount)` Creates an expression that subtracts a specified amount of time to this timestamp expression. |
| `final @NonNull Expression` | `timestampSubtract(@NonNull String unit, long amount)` Creates an expression that subtracts a specified amount of time to this timestamp expression. |
| `static final @NonNull Expression` | `timestampSubtract( @NonNull String fieldName, @NonNull Expression unit, @NonNull Expression amount )` Creates an expression that subtracts a specified amount of time to a timestamp. |
| `static final @NonNull Expression` | `timestampSubtract( @NonNull String fieldName, @NonNull String unit, long amount )` Creates an expression that subtracts a specified amount of time to a timestamp. |
| `static final @NonNull Expression` | `timestampSubtract( @NonNull Expression timestamp, @NonNull Expression unit, @NonNull Expression amount )` Creates an expression that subtracts a specified amount of time to a timestamp. |
| `static final @NonNull Expression` | `timestampSubtract( @NonNull Expression timestamp, @NonNull String unit, long amount )` Creates an expression that subtracts a specified amount of time to a timestamp. |
| `final @NonNull 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). |
| `static final @NonNull Expression` | `timestampToUnixMicros(@NonNull 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). |
| `static final @NonNull Expression` | `timestampToUnixMicros(@NonNull 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). |
| `final @NonNull 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). |
| `static final @NonNull Expression` | `timestampToUnixMillis(@NonNull 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). |
| `static final @NonNull Expression` | `timestampToUnixMillis(@NonNull 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). |
| `final @NonNull 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). |
| `static final @NonNull Expression` | `timestampToUnixSeconds(@NonNull 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). |
| `static final @NonNull Expression` | `timestampToUnixSeconds(@NonNull 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). |
| `final @NonNull Expression` | `timestampTruncate(@NonNull Expression granularity)` Creates an expression that truncates this timestamp expression to a specified granularity. |
| `final @NonNull Expression` | `timestampTruncate(@NonNull String granularity)` Creates an expression that truncates this timestamp expression to a specified granularity. |
| `static final @NonNull Expression` | `timestampTruncate( @NonNull String fieldName, @NonNull Expression granularity )` Creates an expression that truncates a timestamp to a specified granularity. |
| `static final @NonNull Expression` | `timestampTruncate(@NonNull String fieldName, @NonNull String granularity)` Creates an expression that truncates a timestamp to a specified granularity. |
| `static final @NonNull Expression` | `timestampTruncate( @NonNull Expression timestamp, @NonNull Expression granularity )` Creates an expression that truncates a timestamp to a specified granularity. |
| `static final @NonNull Expression` | `timestampTruncate( @NonNull Expression timestamp, @NonNull String granularity )` Creates an expression that truncates a timestamp to a specified granularity. |
| `final @NonNull Expression` | `timestampTruncateWithTimezone( @NonNull Expression granularity, @NonNull Expression timezone )` Creates an expression that truncates this timestamp expression to a specified granularity in a given timezone. |
| `final @NonNull Expression` | `timestampTruncateWithTimezone( @NonNull Expression granularity, @NonNull String timezone )` Creates an expression that truncates this timestamp expression to a specified granularity in a given timezone. |
| `final @NonNull Expression` | `timestampTruncateWithTimezone( @NonNull String granularity, @NonNull Expression timezone )` Creates an expression that truncates this timestamp expression to a specified granularity in a given timezone. |
| `final @NonNull Expression` | `timestampTruncateWithTimezone( @NonNull String granularity, @NonNull String timezone )` Creates an expression that truncates this timestamp expression to a specified granularity in a given timezone. |
| `static final @NonNull Expression` | `timestampTruncateWithTimezone( @NonNull String fieldName, @NonNull Expression granularity, @NonNull Expression timezone )` Creates an expression that truncates a timestamp to a specified granularity in a given timezone. |
| `static final @NonNull Expression` | `timestampTruncateWithTimezone( @NonNull String fieldName, @NonNull Expression granularity, @NonNull String timezone )` Creates an expression that truncates a timestamp to a specified granularity in a given timezone. |
| `static final @NonNull Expression` | `timestampTruncateWithTimezone( @NonNull String fieldName, @NonNull String granularity, @NonNull Expression timezone )` Creates an expression that truncates a timestamp to a specified granularity in a given timezone. |
| `static final @NonNull Expression` | `timestampTruncateWithTimezone( @NonNull String fieldName, @NonNull String granularity, @NonNull String timezone )` Creates an expression that truncates a timestamp to a specified granularity in a given timezone. |
| `static final @NonNull Expression` | `timestampTruncateWithTimezone( @NonNull Expression timestamp, @NonNull Expression granularity, @NonNull Expression timezone )` Creates an expression that truncates a timestamp to a specified granularity in a given timezone. |
| `static final @NonNull Expression` | `timestampTruncateWithTimezone( @NonNull Expression timestamp, @NonNull Expression granularity, @NonNull String timezone )` Creates an expression that truncates a timestamp to a specified granularity in a given timezone. |
| `static final @NonNull Expression` | `timestampTruncateWithTimezone( @NonNull Expression timestamp, @NonNull String granularity, @NonNull Expression timezone )` Creates an expression that truncates a timestamp to a specified granularity in a given timezone. |
| `static final @NonNull Expression` | `timestampTruncateWithTimezone( @NonNull Expression timestamp, @NonNull String granularity, @NonNull String timezone )` Creates an expression that truncates a timestamp to a specified granularity in a given timezone. |
| `final @NonNull Expression` | `toLower()` Creates an expression that converts this string expression to lowercase. |
| `static final @NonNull Expression` | `toLower(@NonNull String fieldName)` Creates an expression that converts a string field to lowercase. |
| `static final @NonNull Expression` | `toLower(@NonNull Expression stringExpression)` Creates an expression that converts a string expression to lowercase. |
| `final @NonNull Expression` | `toUpper()` Creates an expression that converts this string expression to uppercase. |
| `static final @NonNull Expression` | `toUpper(@NonNull String fieldName)` Creates an expression that converts a string field to uppercase. |
| `static final @NonNull Expression` | `toUpper(@NonNull Expression stringExpression)` Creates an expression that converts a string expression to uppercase. |
| `final @NonNull Expression` | `trim()` Creates an expression that removes leading and trailing whitespace from this string expression. |
| `static final @NonNull Expression` | `trim(@NonNull String fieldName)` Creates an expression that removes leading and trailing whitespace from a string field. |
| `static final @NonNull Expression` | `trim(@NonNull Expression stringExpression)` Creates an expression that removes leading and trailing whitespace from a string expression. |
| `final @NonNull Expression` | `trimValue(@NonNull Expression valueToTrim)` Creates an expression that removes a set of leading and trailing values from this expression. |
| `final @NonNull Expression` | `trimValue(@NonNull String valueToTrim)` Creates an expression that removes a set of leading and trailing values from this string expression. |
| `static final @NonNull Expression` | `trimValue(@NonNull String fieldName, @NonNull String valueToTrim)` Creates an expression that removes a set of leading and trailing values from a string field. |
| `static final @NonNull Expression` | `trimValue( @NonNull Expression stringExpression, @NonNull Expression valueToTrim )` Creates an expression that removes a set of leading and trailing values from an expression. |
| `final @NonNull Expression` | `trunc()` Creates an expression that truncates this numeric expression to an integer. |
| `static final @NonNull Expression` | `trunc(@NonNull Expression numericExpr)` Creates an expression that truncates `numericExpr` to an integer. |
| `static final @NonNull Expression` | `trunc(@NonNull String numericField)` Creates an expression that truncates `numericField` to an integer. |
| `final @NonNull Expression` | `truncToPrecision(@NonNull Expression decimalPlace)` Creates an expression that truncates this numeric expression to `decimalPlace` decimal places if `decimalPlace` is positive, truncates digits to the left of the decimal point if `decimalPlace` is negative. |
| `final @NonNull Expression` | `truncToPrecision(int decimalPlace)` Creates an expression that truncates this numeric expression to `decimalPlace` decimal places if `decimalPlace` is positive, truncates digits to the left of the decimal point if `decimalPlace` is negative. |
| `static final @NonNull Expression` | `truncToPrecision( @NonNull Expression numericExpr, @NonNull Expression decimalPlace )` Creates an expression that truncates `numericExpr` to `decimalPlace` decimal places if `decimalPlace` is positive, truncates digits to the left of the decimal point if `decimalPlace` is negative. |
| `static final @NonNull Expression` | `truncToPrecision(@NonNull Expression numericExpr, int decimalPlace)` Creates an expression that truncates `numericExpr` to `decimalPlace` decimal places if `decimalPlace` is positive, truncates digits to the left of the decimal point if `decimalPlace` is negative. |
| `static final @NonNull Expression` | `truncToPrecision( @NonNull String numericField, @NonNull Expression decimalPlace )` Creates an expression that truncates `numericField` to `decimalPlace` decimal places if `decimalPlace` is positive, truncates digits to the left of the decimal point if `decimalPlace` is negative. |
| `static final @NonNull Expression` | `truncToPrecision(@NonNull String numericField, int decimalPlace)` Creates an expression that truncates `numericField` to `decimalPlace` decimal places if `decimalPlace` is positive, truncates digits to the left of the decimal point if `decimalPlace` is negative. |
| `final @NonNull Expression` | `type()` Creates an expression that returns a string indicating the type of the value this expression evaluates to. |
| `static final @NonNull Expression` | `type(@NonNull Expression expr)` Creates an expression that returns a string indicating the type of the value this expression evaluates to. |
| `static final @NonNull Expression` | `type(@NonNull String fieldName)` Creates an expression that returns a string indicating the type of the value this field evaluates to. |
| `final @NonNull 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. |
| `static final @NonNull Expression` | `unixMicrosToTimestamp(@NonNull Expression expr)` Creates an expression that interprets an expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. |
| `static final @NonNull Expression` | `unixMicrosToTimestamp(@NonNull 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. |
| `final @NonNull 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. |
| `static final @NonNull Expression` | `unixMillisToTimestamp(@NonNull 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. |
| `static final @NonNull Expression` | `unixMillisToTimestamp(@NonNull 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. |
| `final @NonNull 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. |
| `static final @NonNull Expression` | `unixSecondsToTimestamp(@NonNull 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. |
| `static final @NonNull Expression` | `unixSecondsToTimestamp(@NonNull 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. |
| `static final @NonNull Expression` | `variable(@NonNull String name)` Creates an expression that retrieves the value of a variable bound via `Pipeline.define`. |
| `static final @NonNull Expression` | `vector(@NonNull double[] vector)` Create a vector constant for a `DoubleArray` value. |
| `static final @NonNull Expression` | `vector(@NonNull VectorValue vector)` Create a vector constant for a `VectorValue` value. |
| `final @NonNull Expression` | `vectorLength()` Creates an expression that calculates the length (dimension) of a Firestore Vector. |
| `static final @NonNull Expression` | `vectorLength(@NonNull String fieldName)` Creates an expression that calculates the length (dimension) of a Firestore Vector. |
| `static final @NonNull Expression` | `vectorLength(@NonNull Expression vectorExpression)` Creates an expression that calculates the length (dimension) of a Firestore Vector. |
| `static final @NonNull BooleanExpression` | `xor( @NonNull BooleanExpression condition, @NonNull BooleanExpression conditions )` Creates an expression that performs a logical 'XOR' operation. |

## Public methods

### abs

```
public final @NonNull Expression abs()
```

Creates an expression that returns the absolute value of this expression.

```
// Get the absolute value of the 'change' field.
field("change").abs()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the absolute value operation. |

### abs

```
public static final @NonNull Expression abs(@NonNull Expression numericExpr)
```

Creates an expression that returns the absolute value of `numericExpr`.

```
// Get the absolute value of the 'change' field.
abs(field("change"))
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the absolute value operation. |

### abs

```
public static final @NonNull Expression abs(@NonNull String numericField)
```

Creates an expression that returns the absolute value of `numericField`.

```
// Get the absolute value of the 'change' field.
abs("change")
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the absolute value operation. |

### add

```
public final @NonNull Expression add(@NonNull Expression second)
```

Creates an expression that adds this numeric expression to another numeric expression.

```
// Add the value of the 'quantity' field and the 'reserve' field.
field("quantity").add(field("reserve"))
```

| Parameters |
|---|---|
| `@NonNull Expression second` | Numeric expression to add. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the addition operation. |

### add

```
public final @NonNull Expression add(@NonNull Number second)
```

Creates an expression that adds this numeric expression to a constants.

```
// Add 5 to the value of the 'quantity' field.
field("quantity").add(5)
```

| Parameters |
|---|---|
| `@NonNull Number second` | Constant to add. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the addition operation. |

### add

```
public static final @NonNull Expression add(@NonNull Expression first, @NonNull Expression second)
```

Creates an expression that adds numeric expressions.

```
// Add the value of the 'quantity' field and the 'reserve' field.
add(field("quantity"), field("reserve"))
```

| Parameters |
|---|---|
| `@NonNull Expression first` | Numeric expression to add. |
| `@NonNull Expression second` | Numeric expression to add. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the addition operation. |

### add

```
public static final @NonNull Expression add(@NonNull Expression first, @NonNull Number second)
```

Creates an expression that adds numeric expressions with a constant.

```
// Add 5 to the value of the 'quantity' field.
add(field("quantity"), 5)
```

| Parameters |
|---|---|
| `@NonNull Expression first` | Numeric expression to add. |
| `@NonNull Number second` | Constant to add. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the addition operation. |

### add

```
public static final @NonNull Expression add(@NonNull String numericFieldName, @NonNull Expression second)
```

Creates an expression that adds a numeric field with a numeric expression.

```
// Add the value of the 'quantity' field and the 'reserve' field.
add("quantity", field("reserve"))
```

| Parameters |
|---|---|
| `@NonNull String numericFieldName` | Numeric field to add. |
| `@NonNull Expression second` | Numeric expression to add to field value. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the addition operation. |

### add

```
public static final @NonNull Expression add(@NonNull String numericFieldName, @NonNull Number second)
```

Creates an expression that adds a numeric field with constant.

```
// Add 5 to the value of the 'quantity' field.
add("quantity", 5)
```

| Parameters |
|---|---|
| `@NonNull String numericFieldName` | Numeric field to add. |
| `@NonNull Number second` | Constant to add. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the addition operation. |

### alias

```
public @NonNull AliasedExpression alias(@NonNull 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.

| Parameters |
|---|---|
| `@NonNull String alias` | The alias to assign to this expression. |

| Returns |
|---|---|
| `@NonNull AliasedExpression` | A `AliasedExpression` that wraps this expression and associates it with the provided alias. |

### and

```
public static final @NonNull BooleanExpression and(
    @NonNull BooleanExpression condition,
    @NonNull BooleanExpression conditions
)
```

Creates an expression that performs a logical 'AND' operation.

```
// Check if 'status' is "new" and 'priority' is greater than 1
and(field("status").equal("new"), field("priority").greaterThan(1))
```

| Parameters |
|---|---|
| `@NonNull BooleanExpression condition` | The first `BooleanExpression`. |
| `@NonNull BooleanExpression conditions` | Additional `BooleanExpression`s. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the logical 'AND' operation. |

### array

```
public static final @NonNull Expression array(@NonNull List<Object> elements)
```

Creates an expression that creates a Firestore array value from an input array.

| Parameters |
|---|---|
| `@NonNull List<Object> elements` | The input array to evaluate in the expression. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the array function. |

### array

```
public static final @NonNull Expression array(Object elements)
```

Creates an expression that creates a Firestore array value from an input array.

```
// Create an array of numbers
array(1, 2, 3)

// Create an array containing a field value and a constant
array(field("quantity"), 10)
```

| Parameters |
|---|---|
| `Object elements` | The input array to evaluate in the expression. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the array function. |

### arrayAgg

```
public final @NonNull AggregateFunction arrayAgg()
```

Creates an aggregation that collects all values of this expression across multiple stage inputs into an array.

If the expression resolves to an absent value, it is converted to `null`. The order of elements in the output array is not stable and shouldn't be relied upon.

| Returns |
|---|---|
| `@NonNull AggregateFunction` | A new `AggregateFunction` representing the array_agg aggregation. |

### arrayAggDistinct

```
public final @NonNull AggregateFunction arrayAggDistinct()
```

Creates an aggregation that collects all distinct values of this expression across multiple stage inputs into an array.

If the expression resolves to an absent value, it is converted to `null`. The order of elements in the output array is not stable and shouldn't be relied upon.

| Returns |
|---|---|
| `@NonNull AggregateFunction` | A new `AggregateFunction` representing the array_agg_distinct aggregation. |

### arrayConcat

```
public final @NonNull Expression arrayConcat(@NonNull Object secondArray, @NonNull Object otherArrays)
```

Creates an expression that concatenates a field's array value with other arrays.

```
// Combine the 'items' array with a literal array.
field("items").arrayConcat(listOf("a", "b"))
```

| Parameters |
|---|---|
| `@NonNull Object secondArray` | An array expression or array literal to concatenate. |
| `@NonNull Object otherArrays` | Optional additional array expressions or array literals to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayConcat operation. |

### arrayConcat

```
public final @NonNull Expression arrayConcat(@NonNull Expression secondArray, @NonNull Object otherArrays)
```

Creates an expression that concatenates a field's array value with other arrays.

```
// Combine the 'items' array with another array field.
field("items").arrayConcat(field("otherItems"))
```

| Parameters |
|---|---|
| `@NonNull Expression secondArray` | An expression that evaluates to array to concatenate. |
| `@NonNull Object otherArrays` | Optional additional array expressions or array literals to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayConcat operation. |

### arrayConcat

```
public static final @NonNull Expression arrayConcat(
    @NonNull Expression firstArray,
    @NonNull Object secondArray,
    @NonNull Object otherArrays
)
```

Creates an expression that concatenates an array with other arrays.

```
// Combine the 'items' array with another array field.
arrayConcat(field("items"), field("otherItems"))
```

| Parameters |
|---|---|
| `@NonNull Expression firstArray` | The first array expression to concatenate to. |
| `@NonNull Object secondArray` | An array expression or array literal to concatenate. |
| `@NonNull Object otherArrays` | Optional additional array expressions or array literals to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayConcat operation. |

### arrayConcat

```
public static final @NonNull Expression arrayConcat(
    @NonNull Expression firstArray,
    @NonNull Expression secondArray,
    @NonNull Object otherArrays
)
```

Creates an expression that concatenates an array with other arrays.

```
// Combine the 'items' array with another array field.
arrayConcat(field("items"), field("otherItems"))
```

| Parameters |
|---|---|
| `@NonNull Expression firstArray` | The first array expression to concatenate to. |
| `@NonNull Expression secondArray` | An expression that evaluates to array to concatenate. |
| `@NonNull Object otherArrays` | Optional additional array expressions or array literals to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayConcat operation. |

### arrayConcat

```
public static final @NonNull Expression arrayConcat(
    @NonNull String firstArrayField,
    @NonNull Object secondArray,
    @NonNull Object otherArrays
)
```

Creates an expression that concatenates a field's array value with other arrays.

```
// Combine the 'items' array with a literal array.
arrayConcat("items", listOf("a", "b"))
```

| Parameters |
|---|---|
| `@NonNull String firstArrayField` | The name of field that contains first array to concatenate to. |
| `@NonNull Object secondArray` | An array expression or array literal to concatenate. |
| `@NonNull Object otherArrays` | Optional additional array expressions or array literals to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayConcat operation. |

### arrayConcat

```
public static final @NonNull Expression arrayConcat(
    @NonNull String firstArrayField,
    @NonNull Expression secondArray,
    @NonNull Object otherArrays
)
```

Creates an expression that concatenates a field's array value with other arrays.

```
// Combine the 'items' array with another array field.
arrayConcat("items", field("otherItems"))
```

| Parameters |
|---|---|
| `@NonNull String firstArrayField` | The name of field that contains first array to concatenate to. |
| `@NonNull Expression secondArray` | An expression that evaluates to array to concatenate. |
| `@NonNull Object otherArrays` | Optional additional array expressions or array literals to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayConcat operation. |

### arrayContains

```
public final @NonNull BooleanExpression arrayContains(@NonNull Object element)
```

Creates an expression that checks if array contains a specific `element`.

```
// Check if the 'colors' array contains "red"
field("colors").arrayContains("red")
```

| Parameters |
|---|---|
| `@NonNull Object element` | The element to search for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContains operation. |

### arrayContains

```
public final @NonNull BooleanExpression arrayContains(@NonNull Expression element)
```

Creates an expression that checks if array contains a specific `element`.

```
// Check if the 'sizes' array contains the value from the 'selectedSize' field
field("sizes").arrayContains(field("selectedSize"))
```

| Parameters |
|---|---|
| `@NonNull Expression element` | The element to search for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContains operation. |

### arrayContains

```
public static final @NonNull BooleanExpression arrayContains(@NonNull Expression array, @NonNull Object element)
```

Creates an expression that checks if the `array` contains a specific `element`.

```
// Check if the 'sizes' array contains the value from the 'selectedSize' field
arrayContains(field("sizes"), field("selectedSize"))

// Check if the 'colors' array contains "red"
arrayContains(field("colors"), "red")
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to check. |
| `@NonNull Object element` | The element to search for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContains operation. |

### arrayContains

```
public static final @NonNull BooleanExpression arrayContains(@NonNull Expression array, @NonNull Expression element)
```

Creates an expression that checks if the array contains a specific `element`.

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to check. |
| `@NonNull Expression element` | The element to search for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContains operation. |

### arrayContains

```
public static final @NonNull BooleanExpression arrayContains(@NonNull String arrayFieldName, @NonNull Object element)
```

Creates an expression that checks if the array field contains a specific `element`.

```
// Check if the 'colors' array contains "red"
arrayContains("colors", "red")
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains array to check. |
| `@NonNull Object element` | The element to search for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContains operation. |

### arrayContains

```
public static final @NonNull BooleanExpression arrayContains(@NonNull String arrayFieldName, @NonNull Expression element)
```

Creates an expression that checks if the array field contains a specific `element`.

```
// Check if the 'sizes' array contains the value from the 'selectedSize' field
arrayContains("sizes", field("selectedSize"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains array to check. |
| `@NonNull Expression element` | The element to search for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContains operation. |

### arrayContainsAll

```
public final @NonNull BooleanExpression arrayContainsAll(@NonNull Expression arrayExpression)
```

Creates an expression that checks if array contains all elements of `arrayExpression`.

```
// Check if the 'tags' array contains both of the values from field "tag1" and the literal value "tag2"
field("tags").arrayContainsAll(array(field("tag1"), "tag2"))
```

| Parameters |
|---|---|
| `@NonNull Expression arrayExpression` | The elements to check for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContainsAll operation. |

### arrayContainsAll

```
public final @NonNull BooleanExpression arrayContainsAll(@NonNull List<@NonNull Object> values)
```

Creates an expression that checks if array contains all the specified `values`.

```
// Check if the 'tags' array contains both the value in field "tag1" and the literal value "tag2"
field("tags").arrayContainsAll(listOf(field("tag1"), "tag2"))
```

| Parameters |
|---|---|
| `@NonNull List<@NonNull Object> values` | The elements to check for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContainsAll operation. |

### arrayContainsAll

```
public static final @NonNull BooleanExpression arrayContainsAll(
    @NonNull Expression array,
    @NonNull Expression arrayExpression
)
```

Creates an expression that checks if `array` contains all elements of `arrayExpression`.

```
// Check if the 'tags' array contains both of the values from field "tag1" and the literal value "tag2"
arrayContainsAll(field("tags"), array(field("tag1"), "tag2"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to check. |
| `@NonNull Expression arrayExpression` | The elements to check for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContainsAll operation. |

### arrayContainsAll

```
public static final @NonNull BooleanExpression arrayContainsAll(
    @NonNull Expression array,
    @NonNull List<@NonNull Object> values
)
```

Creates an expression that checks if `array` contains all the specified `values`.

```
// Check if the 'tags' array contains both the value in field "tag1" and the literal value "tag2"
arrayContainsAll(field("tags"), listOf(field("tag1"), "tag2"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to check. |
| `@NonNull List<@NonNull Object> values` | The elements to check for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContainsAll operation. |

### arrayContainsAll

```
public static final @NonNull BooleanExpression arrayContainsAll(
    @NonNull String arrayFieldName,
    @NonNull Expression arrayExpression
)
```

Creates an expression that checks if array field contains all elements of `arrayExpression`.

```
// Check if the 'permissions' array contains all the required permissions
arrayContainsAll("permissions", field("requiredPermissions"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains array to check. |
| `@NonNull Expression arrayExpression` | The elements to check for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContainsAll operation. |

### arrayContainsAll

```
public static final @NonNull BooleanExpression arrayContainsAll(
    @NonNull String arrayFieldName,
    @NonNull List<@NonNull Object> values
)
```

Creates an expression that checks if array field contains all the specified `values`.

```
// Check if the 'tags' array contains both "internal" and "public"
arrayContainsAll("tags", listOf("internal", "public"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains array to check. |
| `@NonNull List<@NonNull Object> values` | The elements to check for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContainsAll operation. |

### arrayContainsAny

```
public final @NonNull BooleanExpression arrayContainsAny(@NonNull Expression arrayExpression)
```

Creates an expression that checks if array contains any elements of `arrayExpression`.

```
// Check if the 'groups' array contains either the value from the 'userGroup' field
// or the value "guest"
field("groups").arrayContainsAny(array(field("userGroup"), "guest"))
```

| Parameters |
|---|---|
| `@NonNull Expression arrayExpression` | The elements to check for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContainsAny operation. |

### arrayContainsAny

```
public final @NonNull BooleanExpression arrayContainsAny(@NonNull List<@NonNull Object> values)
```

Creates an expression that checks if array contains any of the specified `values`.

```
// Check if the 'categories' array contains either values from field "cate1" or "cate2"
field("categories").arrayContainsAny(listOf(field("cate1"), field("cate2")))
```

| Parameters |
|---|---|
| `@NonNull List<@NonNull Object> values` | The elements to check for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContainsAny operation. |

### arrayContainsAny

```
public static final @NonNull BooleanExpression arrayContainsAny(
    @NonNull Expression array,
    @NonNull Expression arrayExpression
)
```

Creates an expression that checks if `array` contains any elements of `arrayExpression`.

```
// Check if the 'groups' array contains either the value from the 'userGroup' field
// or the value "guest"
arrayContainsAny(field("groups"), array(field("userGroup"), "guest"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to check. |
| `@NonNull Expression arrayExpression` | The elements to check for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContainsAny operation. |

### arrayContainsAny

```
public static final @NonNull BooleanExpression arrayContainsAny(
    @NonNull Expression array,
    @NonNull List<@NonNull Object> values
)
```

Creates an expression that checks if `array` contains any of the specified `values`.

```
// Check if the 'categories' array contains either values from field "cate1" or "cate2"
arrayContainsAny(field("categories"), listOf(field("cate1"), field("cate2")))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to check. |
| `@NonNull List<@NonNull Object> values` | The elements to check for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContainsAny operation. |

### arrayContainsAny

```
public static final @NonNull BooleanExpression arrayContainsAny(
    @NonNull String arrayFieldName,
    @NonNull Expression arrayExpression
)
```

Creates an expression that checks if array field contains any elements of `arrayExpression`.

```
// Check if the 'userGroups' array contains any of the 'targetGroups'
arrayContainsAny("userGroups", field("targetGroups"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains array to check. |
| `@NonNull Expression arrayExpression` | The elements to check for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContainsAny operation. |

### arrayContainsAny

```
public static final @NonNull BooleanExpression arrayContainsAny(
    @NonNull String arrayFieldName,
    @NonNull List<@NonNull Object> values
)
```

Creates an expression that checks if array field contains any of the specified `values`.

```
// Check if the 'roles' array contains "admin" or "editor"
arrayContainsAny("roles", listOf("admin", "editor"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains array to check. |
| `@NonNull List<@NonNull Object> values` | The elements to check for in the array. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the arrayContainsAny operation. |

### arrayFilter

```
public final @NonNull Expression arrayFilter(@NonNull String alias, @NonNull BooleanExpression filter)
```

Filters this array expression based on a predicate.

```
// Filter 'scores' array to include only values greater than 50
field("scores").arrayFilter("score", greaterThan(variable("score"), 50))
```

| Parameters |
|---|---|
| `@NonNull String alias` | The alias to use for the current element in the filter expression. |
| `@NonNull BooleanExpression filter` | The predicate boolean expression used to filter the elements. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayFilter operation. |

### arrayFilter

```
public static final @NonNull Expression arrayFilter(
    @NonNull Expression array,
    @NonNull String alias,
    @NonNull BooleanExpression filter
)
```

Filters an `array` expression based on a predicate.

```
// Filter 'scores' array to include only values greater than 50
arrayFilter(field("scores"), "score", greaterThan(variable("score"), 50))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to filter. |
| `@NonNull String alias` | The alias to use for the current element in the filter expression. |
| `@NonNull BooleanExpression filter` | The predicate boolean expression used to filter the elements. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayFilter operation. |

### arrayFilter

```
public static final @NonNull Expression arrayFilter(
    @NonNull String arrayFieldName,
    @NonNull String alias,
    @NonNull BooleanExpression filter
)
```

Filters an array field based on a predicate.

```
// Filter 'scores' array to include only values greater than 50
arrayFilter("scores", "score", greaterThan(variable("score"), 50))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains array to filter. |
| `@NonNull String alias` | The alias to use for the current element in the filter expression. |
| `@NonNull BooleanExpression filter` | The predicate boolean expression used to filter the elements. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayFilter operation. |

### arrayFirst

```
public final @NonNull Expression arrayFirst()
```

Creates an expression that returns the first element of an array expression.

```
// Get the first element of the 'myArray' field.
field("myArray").arrayFirst()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first element. |

### arrayFirst

```
public static final @NonNull Expression arrayFirst(@NonNull Expression array)
```

Creates an expression that returns the first element of an `array` expression.

```
// Get the first element of the 'myArray' field.
arrayFirst(field("myArray"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to get the first element from. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first element. |

### arrayFirst

```
public static final @NonNull Expression arrayFirst(@NonNull String arrayFieldName)
```

Creates an expression that returns the first element of an array field.

```
// Get the first element of the 'myArray' field.
arrayFirst("myArray")
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the first element from. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first element. |

### arrayFirstN

```
public final @NonNull Expression arrayFirstN(@NonNull Expression n)
```

Creates an expression that returns the first N elements of an array expression.

```
// Get the first 2 elements of the 'myArray' field.
field("myArray").arrayFirstN(2)
```

| Parameters |
|---|---|
| `@NonNull Expression n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first N elements. |

### arrayFirstN

```
public final @NonNull Expression arrayFirstN(int n)
```

Creates an expression that returns the first N elements of an array expression.

```
// Get the first 2 elements of the 'myArray' field.
field("myArray").arrayFirstN(2)
```

| Parameters |
|---|---|
| `int n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first N elements. |

### arrayFirstN

```
public static final @NonNull Expression arrayFirstN(@NonNull Expression array, @NonNull Expression n)
```

Creates an expression that returns the first `n` elements of an `array` expression.

```
// Get the first n elements of the 'myArray' field.
arrayFirstN(field("myArray"), field("count"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `@NonNull Expression n` | An expression evaluating to the number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` elements. |

### arrayFirstN

```
public static final @NonNull Expression arrayFirstN(@NonNull Expression array, int n)
```

Creates an expression that returns the first `n` elements of an `array` expression.

```
// Get the first 3 elements of the 'myArray' field.
arrayFirstN(field("myArray"), 3)
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `int n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` elements. |

### arrayFirstN

```
public static final @NonNull Expression arrayFirstN(@NonNull String arrayFieldName, @NonNull Expression n)
```

Creates an expression that returns the first `n` elements of an array field.

```
// Get the first n elements of the 'myArray' field.
arrayFirstN("myArray", field("count"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the first `n` elements from. |
| `@NonNull Expression n` | An expression evaluating to the number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` elements. |

### arrayFirstN

```
public static final @NonNull Expression arrayFirstN(@NonNull String arrayFieldName, int n)
```

Creates an expression that returns the first `n` elements of an array field.

```
// Get the first n elements of the 'myArray' field.
arrayFirstN("myArray", 3)
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the first `n` elements from. |
| `int n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` elements. |

### arrayGet

```
public final @NonNull Expression arrayGet(@NonNull 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.

```
// Return the value in the tags field array at index specified by field 'favoriteTag'.
field("tags").arrayGet(field("favoriteTag"))
```

| Parameters |
|---|---|
| `@NonNull Expression offset` | An Expression evaluating to the index of the element to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayOffset operation. |

### arrayGet

```
public final @NonNull 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.

```
// Return the value in the 'tags' field array at index `1`.
field("tags").arrayGet(1)
```

| Parameters |
|---|---|
| `int offset` | An Expression evaluating to the index of the element to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayOffset operation. |

### arrayGet

```
public static final @NonNull Expression arrayGet(@NonNull Expression array, @NonNull 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.

```
// Return the value in the tags field array at index specified by field 'favoriteTag'.
arrayGet(field("tags"), field("favoriteTag"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | An `Expression` evaluating to an array. |
| `@NonNull Expression offset` | An Expression evaluating to the index of the element to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayOffset operation. |

### arrayGet

```
public static final @NonNull Expression arrayGet(@NonNull Expression array, 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.

```
// Return the value in the 'tags' field array at index `1`.
arrayGet(field("tags"), 1)
```

| Parameters |
|---|---|
| `@NonNull Expression array` | An `Expression` evaluating to an array. |
| `int offset` | The index of the element to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayOffset operation. |

### arrayGet

```
public static final @NonNull Expression arrayGet(@NonNull String arrayFieldName, @NonNull 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.

```
// Return the value in the tags field array at index specified by field 'favoriteTag'.
arrayGet("tags", field("favoriteTag"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of an array field. |
| `@NonNull Expression offset` | An Expression evaluating to the index of the element to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayOffset operation. |

### arrayGet

```
public static final @NonNull Expression arrayGet(@NonNull String arrayFieldName, 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.

```
// Return the value in the 'tags' field array at index `1`.
arrayGet("tags", 1)
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of an array field. |
| `int offset` | The index of the element to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayOffset operation. |

### arrayIndexOf

```
public final @NonNull Expression arrayIndexOf(Object value)
```

Creates an expression that returns the first index where the specified `value` occurs in the `array`.

```
// Get the first index of 'foo' in the 'tags' array field.
field("tags").arrayIndexOf("foo")
```

| Parameters |
|---|---|
| `Object value` | The value to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the index of the value. |

### arrayIndexOf

```
public static final @NonNull Expression arrayIndexOf(@NonNull Expression array, Object value)
```

Creates an expression that returns the index of the first occurrence of the specified `value` in the `array`, or -1 if the value is not found.

```
// Get the index of 'foo' in the 'tags' array field.
arrayIndexOf(field("tags"), "foo")
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `Object value` | The value to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the index of the value. |

### arrayIndexOf

```
public static final @NonNull Expression arrayIndexOf(@NonNull String arrayFieldName, Object value)
```

Creates an expression that returns the index of the first occurrence of the specified `value` in the `array`, or -1 if the value is not found.

```
// Get the index of 'foo' in the 'tags' array field.
arrayIndexOf(field("tags"), "foo")
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the index of the value from. |
| `Object value` | The value to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the index of the value. |

### arrayIndexOfAll

```
public final @NonNull Expression arrayIndexOfAll(Object value)
```

Creates an expression that returns a list of all indices where the specified `value` occurs in the `array`.

```
// Get all indices of 'foo' in the 'tags' array field.
field("tags").arrayIndexOfAll("foo")
```

| Parameters |
|---|---|
| `Object value` | The value to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the list of indices. |

### arrayIndexOfAll

```
public static final @NonNull Expression arrayIndexOfAll(@NonNull Expression array, Object value)
```

Creates an expression that returns a list of all indices where the specified `value` occurs in the `array`.

```
// Get all indices of 'foo' in the 'tags' array field.
arrayIndexOfAll(field("tags"), "foo")
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `Object value` | The value to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the list of indices. |

### arrayIndexOfAll

```
public static final @NonNull Expression arrayIndexOfAll(@NonNull String arrayFieldName, Object value)
```

Creates an expression that returns a list of all indices where the specified `value` occurs in the `array`.

```
// Get all indices of 'foo' in the 'tags' array field.
arrayIndexOfAll(field("tags"), "foo")
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the indices of the value from. |
| `Object value` | The value to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the list of indices. |

### arrayLast

```
public final @NonNull Expression arrayLast()
```

Creates an expression that returns the last element of an array expression.

```
// Get the last element of the 'myArray' field.
field("myArray").arrayLast()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the last element. |

### arrayLast

```
public static final @NonNull Expression arrayLast(@NonNull Expression array)
```

Creates an expression that returns the last element of an `array` expression.

```
// Get the last element of the 'myArray' field.
arrayLast(field("myArray"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to get the last element from. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the last element. |

### arrayLast

```
public static final @NonNull Expression arrayLast(@NonNull String arrayFieldName)
```

Creates an expression that returns the last element of an array field.

```
// Get the last element of the 'myArray' field.
arrayLast("myArray")
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the last element from. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the last element. |

### arrayLastIndexOf

```
public final @NonNull Expression arrayLastIndexOf(Object value)
```

Creates an expression that returns the last index where the specified `value` occurs in the `array`.

```
// Get the last index of 'foo' in the 'tags' array field.
field("tags").arrayLastIndexOf("foo")
```

| Parameters |
|---|---|
| `Object value` | The value to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the index of the value. |

### arrayLastIndexOf

```
public static final @NonNull Expression arrayLastIndexOf(@NonNull Expression array, Object value)
```

Creates an expression that returns the index of the last occurrence of the specified `value` in the `array`, or -1 if the value is not found.

```
// Get the last index of 'foo' in the 'tags' array field.
arrayLastIndexOf(field("tags"), "foo")
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `Object value` | The value to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the last index of the value. |

### arrayLastIndexOf

```
public static final @NonNull Expression arrayLastIndexOf(@NonNull String arrayFieldName, Object value)
```

Creates an expression that returns the index of the last occurrence of the specified `value` in the `array`, or -1 if the value is not found.

```
// Get the last index of 'foo' in the 'tags' array field.
arrayLastIndexOf(field("tags"), "foo")
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the last index of the value from. |
| `Object value` | The value to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the last index of the value. |

### arrayLastN

```
public final @NonNull Expression arrayLastN(@NonNull Expression n)
```

Creates an expression that returns the last N elements of an array expression.

```
// Get the last 2 elements of the 'myArray' field.
field("myArray").arrayLastN(2)
```

| Parameters |
|---|---|
| `@NonNull Expression n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the last N elements. |

### arrayLastN

```
public final @NonNull Expression arrayLastN(int n)
```

Creates an expression that returns the last N elements of an array expression.

```
// Get the last 2 elements of the 'myArray' field.
field("myArray").arrayLastN(2)
```

| Parameters |
|---|---|
| `int n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the last N elements. |

### arrayLastN

```
public static final @NonNull Expression arrayLastN(@NonNull Expression array, @NonNull Expression n)
```

Creates an expression that returns the last `n` elements of an `array` expression.

```
// Get the last n elements of the 'myArray' field.
arrayLastN(field("myArray"), field("count"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `@NonNull Expression n` | An expression evaluating to the number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the last `n` elements. |

### arrayLastN

```
public static final @NonNull Expression arrayLastN(@NonNull Expression array, int n)
```

Creates an expression that returns the last `n` elements of an `array` expression.

```
// Get the last 3 elements of the 'myArray' field.
arrayLastN(field("myArray"), 3)
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `int n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the last `n` elements. |

### arrayLastN

```
public static final @NonNull Expression arrayLastN(@NonNull String arrayFieldName, @NonNull Expression n)
```

Creates an expression that returns the last `n` elements of an array field.

```
// Get the last n elements of the 'myArray' field.
arrayLastN("myArray", field("count"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the last `n` elements from. |
| `@NonNull Expression n` | An expression evaluating to the number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the last `n` elements. |

### arrayLastN

```
public static final @NonNull Expression arrayLastN(@NonNull String arrayFieldName, int n)
```

Creates an expression that returns the last `n` elements of an array field.

```
// Get the last n elements of the 'myArray' field.
arrayLastN("myArray", 3)
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the last `n` elements from. |
| `int n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the last `n` elements. |

### arrayLength

```
public final @NonNull Expression arrayLength()
```

Creates an expression that calculates the length of an array expression.

```
// Get the number of items in the 'cart' array
field("cart").arrayLength()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the length of the array. |

### arrayLength

```
public static final @NonNull Expression arrayLength(@NonNull Expression array)
```

Creates an expression that calculates the length of an `array` expression.

```
// Get the number of items in the 'cart' array
arrayLength(field("cart"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to calculate the length of. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the length of the array. |

### arrayLength

```
public static final @NonNull Expression arrayLength(@NonNull String arrayFieldName)
```

Creates an expression that calculates the length of an array field.

```
// Get the number of items in the 'cart' array
arrayLength("cart")
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to calculate the length of. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the length of the array. |

### arrayMaximum

```
public final @NonNull Expression arrayMaximum()
```

Creates an expression that returns the maximum value of an array expression.

```
// Get the maximum value of the 'myArray' field.
field("myArray").arrayMaximum()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the maximum value. |

### arrayMaximum

```
public static final @NonNull Expression arrayMaximum(@NonNull Expression array)
```

Creates an expression that returns the maximum element of the `array`.

```
// Get the maximum element of the 'myArray' field.
arrayMaximum(field("myArray"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the maximum element. |

### arrayMaximum

```
public static final @NonNull Expression arrayMaximum(@NonNull String arrayFieldName)
```

Creates an expression that returns the maximum element of an array field.

```
// Get the maximum element of the 'myArray' field.
arrayMaximum("myArray")
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the maximum element from. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the maximum element. |

### arrayMaximumN

```
public final @NonNull Expression arrayMaximumN(@NonNull Expression n)
```

Creates an expression that returns the first `n` largest elements of the `array`.

Note: Returns the n largest non-null elements in the array, in descending order. This does not use a stable sort, meaning the order of equivalent elements is undefined.

```
// Get the n largest elements of the 'myArray' field.
field("myArray").arrayMaximumN(field("count"))
```

| Parameters |
|---|---|
| `@NonNull Expression n` | An expression evaluating to the number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` largest elements. |

### arrayMaximumN

```
public final @NonNull Expression arrayMaximumN(int n)
```

Creates an expression that returns the first `n` largest elements of the `array`.

Note: Returns the n largest non-null elements in the array, in descending order. This does not use a stable sort, meaning the order of equivalent elements is undefined.

```
// Get the 3 largest elements of the 'myArray' field.
field("myArray").arrayMaximumN(3)
```

| Parameters |
|---|---|
| `int n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` largest elements. |

### arrayMaximumN

```
public static final @NonNull Expression arrayMaximumN(@NonNull Expression array, @NonNull Expression n)
```

Creates an expression that returns the first `n` largest elements of the `array`.

Note: Returns the n largest non-null elements in the array, in descending order. This does not use a stable sort, meaning the order of equivalent elements is undefined.

```
// Get the n largest elements of the 'myArray' field.
arrayMaximumN(field("myArray"), field("count"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `@NonNull Expression n` | An expression evaluating to the number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` largest elements. |

### arrayMaximumN

```
public static final @NonNull Expression arrayMaximumN(@NonNull Expression array, int n)
```

Creates an expression that returns the first `n` largest elements of the `array`.

Note: Returns the n largest non-null elements in the array, in descending order. This does not use a stable sort, meaning the order of equivalent elements is undefined.

```
// Get the 3 largest elements of the 'myArray' field.
arrayMaximumN(field("myArray"), 3)
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `int n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` largest elements. |

### arrayMaximumN

```
public static final @NonNull Expression arrayMaximumN(@NonNull String arrayFieldName, @NonNull Expression n)
```

Creates an expression that returns the first `n` largest elements of the `array`.

Note: Returns the n largest non-null elements in the array, in descending order. This does not use a stable sort, meaning the order of equivalent elements is undefined.

```
// Get the n largest elements of the 'myArray' field.
arrayMaximumN("myArray", field("count"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the first `n` largest elements from. |
| `@NonNull Expression n` | An expression evaluating to the number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` largest elements. |

### arrayMaximumN

```
public static final @NonNull Expression arrayMaximumN(@NonNull String arrayFieldName, int n)
```

Creates an expression that returns the first `n` largest elements of the `array`.

Note: Returns the n largest non-null elements in the array, in descending order. This does not use a stable sort, meaning the order of equivalent elements is undefined.

```
// Get the 3 largest elements of the 'myArray' field.
arrayMaximumN("myArray", 3)
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the first `n` largest elements from. |
| `int n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` largest elements. |

### arrayMinimum

```
public final @NonNull Expression arrayMinimum()
```

Creates an expression that returns the minimum value of an array expression.

```
// Get the minimum value of the 'myArray' field.
field("myArray").arrayMinimum()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the minimum value. |

### arrayMinimum

```
public static final @NonNull Expression arrayMinimum(@NonNull Expression array)
```

Creates an expression that returns the minimum element of the `array`.

```
// Get the minimum element of the 'myArray' field.
arrayMinimum(field("myArray"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the minimum element. |

### arrayMinimum

```
public static final @NonNull Expression arrayMinimum(@NonNull String arrayFieldName)
```

Creates an expression that returns the minimum element of an array field.

```
// Get the minimum element of the 'myArray' field.
arrayMinimum("myArray")
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the minimum element from. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the minimum element. |

### arrayMinimumN

```
public final @NonNull Expression arrayMinimumN(@NonNull Expression n)
```

Creates an expression that returns the first `n` smallest elements of the `array`.

Note: Returns the n smallest non-null elements in the array, in ascending order. This does not use a stable sort, meaning the order of equivalent elements is undefined.

```
// Get the n smallest elements of the 'myArray' field.
field("myArray").arrayMinimumN(field("count"))
```

| Parameters |
|---|---|
| `@NonNull Expression n` | An expression evaluating to the number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` smallest elements. |

### arrayMinimumN

```
public final @NonNull Expression arrayMinimumN(int n)
```

Creates an expression that returns the first `n` smallest elements of the `array`.

Note: Returns the n smallest non-null elements in the array, in ascending order. This does not use a stable sort, meaning the order of equivalent elements is undefined.

```
// Get the 3 smallest elements of the 'myArray' field.
field("myArray").arrayMinimumN(3)
```

| Parameters |
|---|---|
| `int n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` smallest elements. |

### arrayMinimumN

```
public static final @NonNull Expression arrayMinimumN(@NonNull Expression array, @NonNull Expression n)
```

Creates an expression that returns the first `n` smallest elements of the `array`.

Note: Returns the n smallest non-null elements in the array, in ascending order. This does not use a stable sort, meaning the order of equivalent elements is undefined.

```
// Get the n smallest elements of the 'myArray' field.
arrayMinimumN(field("myArray"), field("count"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `@NonNull Expression n` | An expression evaluating to the number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` smallest elements. |

### arrayMinimumN

```
public static final @NonNull Expression arrayMinimumN(@NonNull Expression array, int n)
```

Creates an expression that returns the first `n` smallest elements of the `array`.

Note: Returns the n smallest non-null elements in the array, in ascending order. This does not use a stable sort, meaning the order of equivalent elements is undefined.

```
// Get the 3 smallest elements of the 'myArray' field.
arrayMinimumN(field("myArray"), 3)
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `int n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` smallest elements. |

### arrayMinimumN

```
public static final @NonNull Expression arrayMinimumN(@NonNull String arrayFieldName, @NonNull Expression n)
```

Creates an expression that returns the first `n` smallest elements of the `array`.

Note: Returns the n smallest non-null elements in the array, in ascending order. This does not use a stable sort, meaning the order of equivalent elements is undefined.

```
// Get the n smallest elements of the 'myArray' field.
arrayMinimumN("myArray", field("count"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the first `n` smallest elements from. |
| `@NonNull Expression n` | An expression evaluating to the number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` smallest elements. |

### arrayMinimumN

```
public static final @NonNull Expression arrayMinimumN(@NonNull String arrayFieldName, int n)
```

Creates an expression that returns the first `n` smallest elements of the `array`.

Note: Returns the n smallest non-null elements in the array, in ascending order. This does not use a stable sort, meaning the order of equivalent elements is undefined.

```
// Get the 3 smallest elements of the 'myArray' field.
arrayMinimumN("myArray", 3)
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing an array to get the first `n` smallest elements from. |
| `int n` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the first `n` smallest elements. |

### arrayReverse

```
public final @NonNull Expression arrayReverse()
```

Reverses the order of elements in the array.

```
// Reverse the value of the 'myArray' field.
field("myArray").arrayReverse()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayReverse operation. |

### arrayReverse

```
public static final @NonNull Expression arrayReverse(@NonNull Expression array)
```

Reverses the order of elements in the `array`.

```
// Reverse the value of the 'myArray' field.
arrayReverse(field("myArray"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to reverse. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayReverse operation. |

### arrayReverse

```
public static final @NonNull Expression arrayReverse(@NonNull String arrayFieldName)
```

Reverses the order of elements in the array field.

```
// Reverse the value of the 'myArray' field.
arrayReverse("myArray")
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains the array to reverse. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayReverse operation. |

### arraySlice

```
public final @NonNull Expression arraySlice(@NonNull Expression offset, @NonNull Expression length)
```

Creates an expression that returns a slice of this array expression.

```
// Get elements from the 'items' array using expressions for offset and length
field("items").arraySlice(field("offset"), field("length"))
```

| Parameters |
|---|---|
| `@NonNull Expression offset` | The starting index. |
| `@NonNull Expression length` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arraySlice operation. |

### arraySlice

```
public final @NonNull Expression arraySlice(int offset, int length)
```

Creates an expression that returns a slice of this array expression.

```
// Get 5 elements from the 'items' array starting from index 2
field("items").arraySlice(2, 5)
```

| Parameters |
|---|---|
| `int offset` | The starting index. |
| `int length` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arraySlice operation. |

### arraySlice

```
public static final @NonNull Expression arraySlice(
    @NonNull Expression array,
    @NonNull Expression offset,
    @NonNull Expression length
)
```

Creates an expression that returns a slice of an `array` expression.

```
// Get elements from the 'items' array using expressions for offset and length
arraySlice(field("items"), field("startIdx"), field("length"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `@NonNull Expression offset` | The starting index. |
| `@NonNull Expression length` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arraySlice operation. |

### arraySlice

```
public static final @NonNull Expression arraySlice(@NonNull Expression array, int offset, int length)
```

Creates an expression that returns a slice of an `array` expression.

```
// Get 5 elements from the 'items' array starting from index 2
arraySlice(field("items"), 2, 5)
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `int offset` | The starting index. |
| `int length` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arraySlice operation. |

### arraySlice

```
public static final @NonNull Expression arraySlice(
    @NonNull String arrayFieldName,
    @NonNull Expression offset,
    @NonNull Expression length
)
```

Creates an expression that returns a slice of an array field.

```
// Get elements from the 'items' array using expressions for offset and length
arraySlice("items", field("startIdx"), field("length"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains the array. |
| `@NonNull Expression offset` | The starting index. |
| `@NonNull Expression length` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arraySlice operation. |

### arraySlice

```
public static final @NonNull Expression arraySlice(@NonNull String arrayFieldName, int offset, int length)
```

Creates an expression that returns a slice of an array field.

```
// Get 5 elements from the 'items' array starting from index 2
arraySlice("items", 2, 5)
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains the array. |
| `int offset` | The starting index. |
| `int length` | The number of elements to return. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arraySlice operation. |

### arraySliceToEnd

```
public final @NonNull Expression arraySliceToEnd(@NonNull Expression offset)
```

Creates an expression that returns a slice of this array expression to its end.

```
// Get elements from the 'items' array starting from the value of the 'offset' field
field("items").arraySliceToEnd(field("offset"))
```

| Parameters |
|---|---|
| `@NonNull Expression offset` | The starting index. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arraySliceToEnd operation. |

### arraySliceToEnd

```
public final @NonNull Expression arraySliceToEnd(int offset)
```

Creates an expression that returns a slice of this array expression to its end.

```
// Get elements from the 'items' array starting from index 2
field("items").arraySliceToEnd(2)
```

| Parameters |
|---|---|
| `int offset` | The starting index. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arraySliceToEnd operation. |

### arraySliceToEnd

```
public static final @NonNull Expression arraySliceToEnd(@NonNull Expression array, @NonNull Expression offset)
```

Creates an expression that returns a slice of an `array` expression to its end.

```
// Get elements from the 'items' array starting at an offset defined by a field
arraySliceToEnd(field("items"), field("startIdx"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `@NonNull Expression offset` | The starting index. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arraySliceToEnd operation. |

### arraySliceToEnd

```
public static final @NonNull Expression arraySliceToEnd(@NonNull Expression array, int offset)
```

Creates an expression that returns a slice of an `array` expression to its end.

```
// Get elements from the 'items' array starting from index 2
arraySliceToEnd(field("items"), 2)
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression. |
| `int offset` | The starting index. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arraySliceToEnd operation. |

### arraySliceToEnd

```
public static final @NonNull Expression arraySliceToEnd(@NonNull String arrayFieldName, @NonNull Expression offset)
```

Creates an expression that returns a slice of an array field to its end.

```
// Get elements from the 'items' array starting at an offset defined by a field
arraySliceToEnd("items", field("startIdx"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains the array. |
| `@NonNull Expression offset` | The starting index. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arraySliceToEnd operation. |

### arraySliceToEnd

```
public static final @NonNull Expression arraySliceToEnd(@NonNull String arrayFieldName, int offset)
```

Creates an expression that returns a slice of an array field to its end.

```
// Get elements from the 'items' array starting from index 2
arraySliceToEnd("items", 2)
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains the array. |
| `int offset` | The starting index. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arraySliceToEnd operation. |

### arraySum

```
public final @NonNull Expression arraySum()
```

Creates an expression that returns the sum of the elements in this array expression.

```
// Get the sum of elements in the 'scores' array.
field("scores").arraySum()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the sum of the array elements. |

### arraySum

```
public static final @NonNull Expression arraySum(@NonNull Expression array)
```

Creates an expression that returns the sum of the elements in an array.

```
// Get the sum of elements in the 'scores' array.
arraySum(field("scores"))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to sum. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the sum of the array elements. |

### arraySum

```
public static final @NonNull Expression arraySum(@NonNull String arrayFieldName)
```

Creates an expression that returns the sum of the elements in an array field.

```
// Get the sum of elements in the 'scores' array.
arraySum("scores")
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing the array to sum. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the sum of the array elements. |

### arrayTransform

```
public final @NonNull Expression arrayTransform(@NonNull String elementAlias, @NonNull Expression transform)
```

Creates an expression that applies a provided transformation to each element in an array.

```
// Transform 'scores' array by multiplying each score by 10
field("scores").arrayTransform("score", multiply(variable("score"), 10))
```

| Parameters |
|---|---|
| `@NonNull String elementAlias` | The alias to use for the current element in the transform expression. |
| `@NonNull Expression transform` | The expression used to transform the elements. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayTransform operation. |

### arrayTransform

```
public static final @NonNull Expression arrayTransform(
    @NonNull Expression array,
    @NonNull String elementAlias,
    @NonNull Expression transform
)
```

Creates an expression that applies a provided transformation to each element in an array.

```
// Transform 'scores' array by multiplying each score by 10
arrayTransform(field("scores"), "score", multiply(variable("score"), 10))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to transform. |
| `@NonNull String elementAlias` | The alias to use for the current element in the transform expression. |
| `@NonNull Expression transform` | The expression used to transform the elements. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayTransform operation. |

### arrayTransform

```
public static final @NonNull Expression arrayTransform(
    @NonNull String arrayFieldName,
    @NonNull String elementAlias,
    @NonNull Expression transform
)
```

Creates an expression that applies a provided transformation to each element in an array.

```
// Transform 'scores' array by multiplying each score by 10
arrayTransform("scores", "score", multiply(variable("score"), 10))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains array to transform. |
| `@NonNull String elementAlias` | The alias to use for the current element in the transform expression. |
| `@NonNull Expression transform` | The expression used to transform the elements. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayTransform operation. |

### arrayTransformWithIndex

```
public final @NonNull Expression arrayTransformWithIndex(
    @NonNull String elementAlias,
    @NonNull String indexAlias,
    @NonNull Expression transform
)
```

Creates an expression that applies a provided transformation to each element in an array, providing the element's index to the transformation expression.

```
// Transform 'scores' array by adding the index
field("scores").arrayTransformWithIndex("score", "i", add(variable("score"), variable("i")))
```

| Parameters |
|---|---|
| `@NonNull String elementAlias` | The alias to use for the current element in the transform expression. |
| `@NonNull String indexAlias` | The alias to use for the current index. |
| `@NonNull Expression transform` | The expression used to transform the elements. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayTransformWithIndex operation. |

### arrayTransformWithIndex

```
public static final @NonNull Expression arrayTransformWithIndex(
    @NonNull Expression array,
    @NonNull String elementAlias,
    @NonNull String indexAlias,
    @NonNull Expression transform
)
```

Creates an expression that applies a provided transformation to each element in an array, providing the element's index to the transformation expression.

```
// Transform 'scores' array by adding the index
arrayTransformWithIndex(field("scores"), "score", "i", add(variable("score"), variable("i")))
```

| Parameters |
|---|---|
| `@NonNull Expression array` | The array expression to transform. |
| `@NonNull String elementAlias` | The alias to use for the current element in the transform expression. |
| `@NonNull String indexAlias` | The alias to use for the current index. |
| `@NonNull Expression transform` | The expression used to transform the elements. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayTransformWithIndex operation. |

### arrayTransformWithIndex

```
public static final @NonNull Expression arrayTransformWithIndex(
    @NonNull String arrayFieldName,
    @NonNull String elementAlias,
    @NonNull String indexAlias,
    @NonNull Expression transform
)
```

Creates an expression that applies a provided transformation to each element in an array, providing the element's index to the transformation expression.

```
// Transform 'scores' array by adding the index
arrayTransformWithIndex("scores", "score", "i", add(variable("score"), variable("i")))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of field that contains array to transform. |
| `@NonNull String elementAlias` | The alias to use for the current element in the transform expression. |
| `@NonNull String indexAlias` | The alias to use for the current index. |
| `@NonNull Expression transform` | The expression used to transform the elements. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the arrayTransformWithIndex operation. |

### asBoolean

```
public final @NonNull BooleanExpression asBoolean()
```

Casts the expression to a `BooleanExpression`.

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A `BooleanExpression` representing the same expression. |

### ascending

```
public final @NonNull Ordering ascending()
```

Create an `Ordering` that sorts documents in ascending order based on value of this expression

| Returns |
|---|---|
| `@NonNull Ordering` | A new `Ordering` object with ascending sort by this expression. |

### average

```
public final @NonNull AggregateFunction average()
```

Creates an aggregation that calculates the average (mean) of this numeric expression across multiple stage inputs.

| Returns |
|---|---|
| `@NonNull AggregateFunction` | A new `AggregateFunction` representing the average aggregation. |

### bitAnd

```
public final @NonNull Expression bitAnd(@NonNull byte[] bitsOther)
```

Creates an expression that applies a bitwise AND operation with a constant.

```
// Bitwise AND the value of the 'flags' field with a constant mask.
field("flags").bitAnd(byteArrayOf(0b00001111))
```

| Parameters |
|---|---|
| `@NonNull byte[] bitsOther` | A constant byte array. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise AND operation. |

### bitAnd

```
public final @NonNull Expression bitAnd(@NonNull Expression bitsOther)
```

Creates an expression that applies a bitwise AND operation with other expression.

```
// Bitwise AND the value of the 'flags' field with the value of the 'mask' field.
field("flags").bitAnd(field("mask"))
```

| Parameters |
|---|---|
| `@NonNull Expression bitsOther` | An expression that returns bits when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise AND operation. |

### bitAnd

```
public static final @NonNull Expression bitAnd(@NonNull Expression bits, @NonNull byte[] bitsOther)
```

Creates an expression that applies a bitwise AND operation between an expression and a constant.

```
// Bitwise AND the value of the 'flags' field with a constant mask.
bitAnd(field("flags"), byteArrayOf(0b00001111))
```

| Parameters |
|---|---|
| `@NonNull Expression bits` | An expression that returns bits when evaluated. |
| `@NonNull byte[] bitsOther` | A constant byte array. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise AND operation. |

### bitAnd

```
public static final @NonNull Expression bitAnd(@NonNull Expression bits, @NonNull Expression bitsOther)
```

Creates an expression that applies a bitwise AND operation between two expressions.

```
// Bitwise AND the value of the 'flags' field with the value of the 'mask' field.
bitAnd(field("flags"), field("mask"))
```

| Parameters |
|---|---|
| `@NonNull Expression bits` | An expression that returns bits when evaluated. |
| `@NonNull Expression bitsOther` | An expression that returns bits when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise AND operation. |

### bitAnd

```
public static final @NonNull Expression bitAnd(@NonNull String bitsFieldName, @NonNull byte[] bitsOther)
```

Creates an expression that applies a bitwise AND operation between an field and constant.

```
// Bitwise AND the value of the 'flags' field with a constant mask.
bitAnd("flags", byteArrayOf(0b00001111))
```

| Parameters |
|---|---|
| `@NonNull String bitsFieldName` | Name of field that contains bits data. |
| `@NonNull byte[] bitsOther` | A constant byte array. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise AND operation. |

### bitAnd

```
public static final @NonNull Expression bitAnd(@NonNull String bitsFieldName, @NonNull Expression bitsOther)
```

Creates an expression that applies a bitwise AND operation between an field and an expression.

```
// Bitwise AND the value of the 'flags' field with the value of the 'mask' field.
bitAnd("flags", field("mask"))
```

| Parameters |
|---|---|
| `@NonNull String bitsFieldName` | Name of field that contains bits data. |
| `@NonNull Expression bitsOther` | An expression that returns bits when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise AND operation. |

### bitLeftShift

```
public final @NonNull Expression bitLeftShift(int number)
```

Creates an expression that applies a bitwise left shift operation with a constant.

```
// Left shift the value of the 'bits' field by 2.
field("bits").bitLeftShift(2)
```

| Parameters |
|---|---|
| `int number` | The number of bits to shift. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise left shift operation. |

### bitLeftShift

```
public final @NonNull Expression bitLeftShift(@NonNull Expression numberExpr)
```

Creates an expression that applies a bitwise left shift operation with an expression.

```
// Left shift the value of the 'bits' field by the value of the 'shift' field.
field("bits").bitLeftShift(field("shift"))
```

| Parameters |
|---|---|
| `@NonNull Expression numberExpr` | The number of bits to shift. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise left shift operation. |

### bitLeftShift

```
public static final @NonNull Expression bitLeftShift(@NonNull Expression bits, int number)
```

Creates an expression that applies a bitwise left shift operation between an expression and a constant.

```
// Left shift the value of the 'bits' field by 2.
bitLeftShift(field("bits"), 2)
```

| Parameters |
|---|---|
| `@NonNull Expression bits` | An expression that returns bits when evaluated. |
| `int number` | The number of bits to shift. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise left shift operation. |

### bitLeftShift

```
public static final @NonNull Expression bitLeftShift(@NonNull Expression bits, @NonNull Expression numberExpr)
```

Creates an expression that applies a bitwise left shift operation between two expressions.

```
// Left shift the value of the 'bits' field by the value of the 'shift' field.
bitLeftShift(field("bits"), field("shift"))
```

| Parameters |
|---|---|
| `@NonNull Expression bits` | An expression that returns bits when evaluated. |
| `@NonNull Expression numberExpr` | The number of bits to shift. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise left shift operation. |

### bitLeftShift

```
public static final @NonNull Expression bitLeftShift(@NonNull String bitsFieldName, int number)
```

Creates an expression that applies a bitwise left shift operation between a field and a constant.

```
// Left shift the value of the 'bits' field by 2.
bitLeftShift("bits", 2)
```

| Parameters |
|---|---|
| `@NonNull String bitsFieldName` | Name of field that contains bits data. |
| `int number` | The number of bits to shift. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise left shift operation. |

### bitLeftShift

```
public static final @NonNull Expression bitLeftShift(@NonNull String bitsFieldName, @NonNull Expression numberExpr)
```

Creates an expression that applies a bitwise left shift operation between a field and an expression.

```
// Left shift the value of the 'bits' field by the value of the 'shift' field.
bitLeftShift("bits", field("shift"))
```

| Parameters |
|---|---|
| `@NonNull String bitsFieldName` | Name of field that contains bits data. |
| `@NonNull Expression numberExpr` | The number of bits to shift. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise left shift operation. |

### bitNot

```
public final @NonNull Expression bitNot()
```

Creates an expression that applies a bitwise NOT operation to this expression.

```
// Bitwise NOT the value of the 'flags' field.
field("flags").bitNot()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise NOT operation. |

### bitNot

```
public static final @NonNull Expression bitNot(@NonNull Expression bits)
```

Creates an expression that applies a bitwise NOT operation to an expression.

```
// Bitwise NOT the value of the 'flags' field.
bitNot(field("flags"))
```

| Parameters |
|---|---|
| `@NonNull Expression bits` | An expression that returns bits when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise NOT operation. |

### bitNot

```
public static final @NonNull Expression bitNot(@NonNull String bitsFieldName)
```

Creates an expression that applies a bitwise NOT operation to a field.

```
// Bitwise NOT the value of the 'flags' field.
bitNot("flags")
```

| Parameters |
|---|---|
| `@NonNull String bitsFieldName` | Name of field that contains bits data. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise NOT operation. |

### bitOr

```
public final @NonNull Expression bitOr(@NonNull byte[] bitsOther)
```

Creates an expression that applies a bitwise OR operation with a constant.

```
// Bitwise OR the value of the 'flags' field with a constant mask.
field("flags").bitOr(byteArrayOf(0b00001111))
```

| Parameters |
|---|---|
| `@NonNull byte[] bitsOther` | A constant byte array. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise OR operation. |

### bitOr

```
public final @NonNull Expression bitOr(@NonNull Expression bitsOther)
```

Creates an expression that applies a bitwise OR operation with other expression.

```
// Bitwise OR the value of the 'flags' field with the value of the 'mask' field.
field("flags").bitOr(field("mask"))
```

| Parameters |
|---|---|
| `@NonNull Expression bitsOther` | An expression that returns bits when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise OR operation. |

### bitOr

```
public static final @NonNull Expression bitOr(@NonNull Expression bits, @NonNull byte[] bitsOther)
```

Creates an expression that applies a bitwise OR operation between an expression and a constant.

```
// Bitwise OR the value of the 'flags' field with a constant mask.
bitOr(field("flags"), byteArrayOf(0b00001111))
```

| Parameters |
|---|---|
| `@NonNull Expression bits` | An expression that returns bits when evaluated. |
| `@NonNull byte[] bitsOther` | A constant byte array. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise OR operation. |

### bitOr

```
public static final @NonNull Expression bitOr(@NonNull Expression bits, @NonNull Expression bitsOther)
```

Creates an expression that applies a bitwise OR operation between two expressions.

```
// Bitwise OR the value of the 'flags' field with the value of the 'mask' field.
bitOr(field("flags"), field("mask"))
```

| Parameters |
|---|---|
| `@NonNull Expression bits` | An expression that returns bits when evaluated. |
| `@NonNull Expression bitsOther` | An expression that returns bits when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise OR operation. |

### bitOr

```
public static final @NonNull Expression bitOr(@NonNull String bitsFieldName, @NonNull byte[] bitsOther)
```

Creates an expression that applies a bitwise OR operation between an field and constant.

```
// Bitwise OR the value of the 'flags' field with a constant mask.
bitOr("flags", byteArrayOf(0b00001111))
```

| Parameters |
|---|---|
| `@NonNull String bitsFieldName` | Name of field that contains bits data. |
| `@NonNull byte[] bitsOther` | A constant byte array. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise OR operation. |

### bitOr

```
public static final @NonNull Expression bitOr(@NonNull String bitsFieldName, @NonNull Expression bitsOther)
```

Creates an expression that applies a bitwise OR operation between an field and an expression.

```
// Bitwise OR the value of the 'flags' field with the value of the 'mask' field.
bitOr("flags", field("mask"))
```

| Parameters |
|---|---|
| `@NonNull String bitsFieldName` | Name of field that contains bits data. |
| `@NonNull Expression bitsOther` | An expression that returns bits when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise OR operation. |

### bitRightShift

```
public final @NonNull Expression bitRightShift(int number)
```

Creates an expression that applies a bitwise right shift operation with a constant.

```
// Right shift the value of the 'bits' field by 2.
field("bits").bitRightShift(2)
```

| Parameters |
|---|---|
| `int number` | The number of bits to shift. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise right shift operation. |

### bitRightShift

```
public final @NonNull Expression bitRightShift(@NonNull Expression numberExpr)
```

Creates an expression that applies a bitwise right shift operation with an expression.

```
// Right shift the value of the 'bits' field by the value of the 'shift' field.
field("bits").bitRightShift(field("shift"))
```

| Parameters |
|---|---|
| `@NonNull Expression numberExpr` | The number of bits to shift. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise right shift operation. |

### bitRightShift

```
public static final @NonNull Expression bitRightShift(@NonNull Expression bits, int number)
```

Creates an expression that applies a bitwise right shift operation between an expression and a constant.

```
// Right shift the value of the 'bits' field by 2.
bitRightShift(field("bits"), 2)
```

| Parameters |
|---|---|
| `@NonNull Expression bits` | An expression that returns bits when evaluated. |
| `int number` | The number of bits to shift. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise right shift operation. |

### bitRightShift

```
public static final @NonNull Expression bitRightShift(@NonNull Expression bits, @NonNull Expression numberExpr)
```

Creates an expression that applies a bitwise right shift operation between two expressions.

```
// Right shift the value of the 'bits' field by the value of the 'shift' field.
bitRightShift(field("bits"), field("shift"))
```

| Parameters |
|---|---|
| `@NonNull Expression bits` | An expression that returns bits when evaluated. |
| `@NonNull Expression numberExpr` | The number of bits to shift. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise right shift operation. |

### bitRightShift

```
public static final @NonNull Expression bitRightShift(@NonNull String bitsFieldName, int number)
```

Creates an expression that applies a bitwise right shift operation between a field and a constant.

```
// Right shift the value of the 'bits' field by 2.
bitRightShift("bits", 2)
```

| Parameters |
|---|---|
| `@NonNull String bitsFieldName` | Name of field that contains bits data. |
| `int number` | The number of bits to shift. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise right shift operation. |

### bitRightShift

```
public static final @NonNull Expression bitRightShift(
    @NonNull String bitsFieldName,
    @NonNull Expression numberExpr
)
```

Creates an expression that applies a bitwise right shift operation between a field and an expression.

```
// Right shift the value of the 'bits' field by the value of the 'shift' field.
bitRightShift("bits", field("shift"))
```

| Parameters |
|---|---|
| `@NonNull String bitsFieldName` | Name of field that contains bits data. |
| `@NonNull Expression numberExpr` | The number of bits to shift. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise right shift operation. |

### bitXor

```
public final @NonNull Expression bitXor(@NonNull byte[] bitsOther)
```

Creates an expression that applies a bitwise XOR operation with a constant.

```
// Bitwise XOR the value of the 'flags' field with a constant mask.
field("flags").bitXor(byteArrayOf(0b00001111))
```

| Parameters |
|---|---|
| `@NonNull byte[] bitsOther` | A constant byte array. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise XOR operation. |

### bitXor

```
public final @NonNull Expression bitXor(@NonNull Expression bitsOther)
```

Creates an expression that applies a bitwise XOR operation with an expression.

```
// Bitwise XOR the value of the 'flags' field with the value of the 'mask' field.
field("flags").bitXor(field("mask"))
```

| Parameters |
|---|---|
| `@NonNull Expression bitsOther` | An expression that returns bits when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise XOR operation. |

### bitXor

```
public static final @NonNull Expression bitXor(@NonNull Expression bits, @NonNull byte[] bitsOther)
```

Creates an expression that applies a bitwise XOR operation between an expression and a constant.

```
// Bitwise XOR the value of the 'flags' field with a constant mask.
bitXor(field("flags"), byteArrayOf(0b00001111))
```

| Parameters |
|---|---|
| `@NonNull Expression bits` | An expression that returns bits when evaluated. |
| `@NonNull byte[] bitsOther` | A constant byte array. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise XOR operation. |

### bitXor

```
public static final @NonNull Expression bitXor(@NonNull Expression bits, @NonNull Expression bitsOther)
```

Creates an expression that applies a bitwise XOR operation between two expressions.

```
// Bitwise XOR the value of the 'flags' field with the value of the 'mask' field.
bitXor(field("flags"), field("mask"))
```

| Parameters |
|---|---|
| `@NonNull Expression bits` | An expression that returns bits when evaluated. |
| `@NonNull Expression bitsOther` | An expression that returns bits when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise XOR operation. |

### bitXor

```
public static final @NonNull Expression bitXor(@NonNull String bitsFieldName, @NonNull byte[] bitsOther)
```

Creates an expression that applies a bitwise XOR operation between an field and constant.

```
// Bitwise XOR the value of the 'flags' field with a constant mask.
bitXor("flags", byteArrayOf(0b00001111))
```

| Parameters |
|---|---|
| `@NonNull String bitsFieldName` | Name of field that contains bits data. |
| `@NonNull byte[] bitsOther` | A constant byte array. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise XOR operation. |

### bitXor

```
public static final @NonNull Expression bitXor(@NonNull String bitsFieldName, @NonNull Expression bitsOther)
```

Creates an expression that applies a bitwise XOR operation between an field and an expression.

```
// Bitwise XOR the value of the 'flags' field with the value of the 'mask' field.
bitXor("flags", field("mask"))
```

| Parameters |
|---|---|
| `@NonNull String bitsFieldName` | Name of field that contains bits data. |
| `@NonNull Expression bitsOther` | An expression that returns bits when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the bitwise XOR operation. |

### byteLength

```
public final @NonNull Expression byteLength()
```

Creates an expression that calculates the length of a string in UTF-8 bytes, or just the length of a Blob.

```
// Calculate the length of the 'myString' field in bytes.
field("myString").byteLength()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the length of the string in bytes. |

### byteLength

```
public static final @NonNull Expression byteLength(@NonNull 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.

```
// Calculate the length of the 'myString' field in bytes.
byteLength("myString")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the length of the string in bytes. |

### byteLength

```
public static final @NonNull Expression byteLength(@NonNull Expression value)
```

Creates an expression that calculates the length of a string in UTF-8 bytes, or just the length of a Blob.

```
// Calculate the length of the 'myString' field in bytes.
byteLength("myString")
```

| Parameters |
|---|---|
| `@NonNull Expression value` | The expression representing the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the length of the string in bytes. |

### ceil

```
public final @NonNull Expression ceil()
```

Creates an expression that returns the smallest integer that isn't less than this numeric expression.

```
// Compute the ceiling of the 'price' field.
field("price").ceil()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing an integer result from the ceil operation. |

### ceil

```
public static final @NonNull Expression ceil(@NonNull Expression numericExpr)
```

Creates an expression that returns the smallest integer that isn't less than `numericExpr`.

```
// Compute the ceiling of the 'price' field.
ceil(field("price"))
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing an integer result from the ceil operation. |

### ceil

```
public static final @NonNull Expression ceil(@NonNull String numericField)
```

Creates an expression that returns the smallest integer that isn't less than `numericField`.

```
// Compute the ceiling of the 'price' field.
ceil("price")
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing an integer result from the ceil operation. |

### charLength

```
public final @NonNull Expression charLength()
```

Creates an expression that calculates the character length of this string expression in UTF8.

```
// Get the character length of the 'name' field in UTF-8.
field("name").charLength()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the charLength operation. |

### charLength

```
public static final @NonNull Expression charLength(@NonNull Expression expr)
```

Creates an expression that calculates the character length of a string expression in UTF8.

```
// Get the character length of the 'name' field in UTF-8.
charLength("name")
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The expression representing the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the charLength operation. |

### charLength

```
public static final @NonNull Expression charLength(@NonNull String fieldName)
```

Creates an expression that calculates the character length of a string field in UTF8.

```
// Get the character length of the 'name' field in UTF-8.
charLength("name")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the charLength operation. |

### coalesce

```
public final @NonNull Expression coalesce(@NonNull Object replacement, @NonNull Object others)
```

Creates an expression that returns the first non-null, non-absent argument, without evaluating the rest of the arguments. When all arguments are null or absent, returns the last argument.

```
// Returns the value of the first non-null, non-absent field among 'preferredName', 'fullName',
// or the last argument if all previous fields are null.
field("preferredName").coalesce(field("fullName"), "Anonymous")
```

| Parameters |
|---|---|
| `@NonNull Object replacement` | The fallback expression or value if the first one is null. |
| `@NonNull Object others` | Optional additional expressions to check if previous ones are null. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the coalesce operation. |

### coalesce

```
public static final @NonNull Expression coalesce(
    @NonNull Expression expression,
    @NonNull Object replacement,
    @NonNull Object others
)
```

Creates an expression that returns the first non-null, non-absent argument, without evaluating the rest of the arguments. When all arguments are null or absent, returns the last argument.

```
// Returns the value of the first non-null, non-absent field among 'preferredName', 'fullName',
// or the last argument if all previous fields are null.
coalesce(field("preferredName"), field("fullName"), constant("Anonymous"))
```

| Parameters |
|---|---|
| `@NonNull Expression expression` | The first expression to check for null. |
| `@NonNull Object replacement` | The fallback expression or value if the first one is null. |
| `@NonNull Object others` | Optional additional expressions to check if previous ones are null. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the coalesce operation. |

### coalesce

```
public static final @NonNull Expression coalesce(
    @NonNull String fieldName,
    @NonNull Object replacement,
    @NonNull Object others
)
```

Creates an expression that returns the first non-null, non-absent argument, without evaluating the rest of the arguments. When all arguments are null or absent, returns the last argument.

```
// Returns the value of the first non-null, non-absent field among 'preferredName', 'fullName',
// or the last argument if all previous fields are null.
coalesce("preferredName", field("fullName"), constant("Anonymous"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the first field to check for null. |
| `@NonNull Object replacement` | The fallback expression or value if the first one is null. |
| `@NonNull Object others` | Optional additional expressions to check if previous ones are null. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the coalesce operation. |

### collectionId

```
public final @NonNull Expression collectionId()
```

Creates an expression that returns the collection ID from this path expression.

```
// Get the collection ID from the 'path' field
field("path").collectionId()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the collectionId operation. |

### collectionId

```
public static final @NonNull Expression collectionId(@NonNull Expression path)
```

Creates an expression that returns the collection ID from a path.

```
// Get the collection ID from the 'path' field
collectionId(field("path"))
```

| Parameters |
|---|---|
| `@NonNull Expression path` | An expression the evaluates to a path. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the collectionId operation. |

### collectionId

```
public static final @NonNull Expression collectionId(@NonNull String pathField)
```

Creates an expression that returns the collection ID from a path.

```
// Get the collection ID from a path field
collectionId("pathField")
```

| Parameters |
|---|---|
| `@NonNull String pathField` | The string representation of the path. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the collectionId operation. |

### concat

```
public final @NonNull Expression concat(@NonNull Object second, @NonNull Object others)
```

Creates an expression that concatenates this expression's value with others. The values must be all strings, all arrays, or all blobs. Types cannot be mixed.

```
// Concatenate a field with a literal string.
field("firstName").concat("lastName")
```

| Parameters |
|---|---|
| `@NonNull Object second` | The second value to concatenate. |
| `@NonNull Object others` | Additional values to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenation. |

### concat

```
public final @NonNull Expression concat(@NonNull Expression second, @NonNull Object others)
```

Creates an expression that concatenates this expression's value with others. The values must be all strings, all arrays, or all blobs. Types cannot be mixed.

```
// Concatenate a field with another field.
field("firstName").concat(field("lastName"))
```

| Parameters |
|---|---|
| `@NonNull Expression second` | The second expression to concatenate. |
| `@NonNull Object others` | Additional expressions to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenation. |

### concat

```
public static final @NonNull Expression concat(
    @NonNull Expression first,
    @NonNull Object second,
    @NonNull Object others
)
```

Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed.

```
// Concatenate a field with a literal string.
concat(field("firstName"), "Doe")
```

| Parameters |
|---|---|
| `@NonNull Expression first` | The first expression to concatenate. |
| `@NonNull Object second` | The second value to concatenate. |
| `@NonNull Object others` | Additional values to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenation. |

### concat

```
public static final @NonNull Expression concat(
    @NonNull Expression first,
    @NonNull Expression second,
    @NonNull Object others
)
```

Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed.

```
// Concatenate the 'firstName' and 'lastName' fields with a space in between.
concat(field("firstName"), " ", field("lastName"))
```

| Parameters |
|---|---|
| `@NonNull Expression first` | The first expression to concatenate. |
| `@NonNull Expression second` | The second expression to concatenate. |
| `@NonNull Object others` | Additional expressions to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenation. |

### concat

```
public static final @NonNull Expression concat(@NonNull String first, @NonNull Object second, @NonNull Object others)
```

Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed.

```
// Concatenate a field name with a literal string.
concat("firstName", "Doe")
```

| Parameters |
|---|---|
| `@NonNull String first` | The name of the field containing the first value to concatenate. |
| `@NonNull Object second` | The second value to concatenate. |
| `@NonNull Object others` | Additional values to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenation. |

### concat

```
public static final @NonNull Expression concat(
    @NonNull String first,
    @NonNull Expression second,
    @NonNull Object others
)
```

Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed.

```
// Concatenate a field name with an expression.
concat("firstName", field("lastName"))
```

| Parameters |
|---|---|
| `@NonNull String first` | The name of the field containing the first value to concatenate. |
| `@NonNull Expression second` | The second expression to concatenate. |
| `@NonNull Object others` | Additional expressions to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenation. |

### conditional

```
public static final @NonNull Expression conditional(
    @NonNull BooleanExpression condition,
    @NonNull Expression thenExpr,
    @NonNull 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 |
|---|---|
| `@NonNull BooleanExpression condition` | The condition to evaluate. |
| `@NonNull Expression thenExpr` | The expression to evaluate if the condition is true. |
| `@NonNull Expression elseExpr` | The expression to evaluate if the condition is false. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the conditional operation. |

### conditional

```
public static final @NonNull Expression conditional(
    @NonNull BooleanExpression condition,
    @NonNull Object thenValue,
    @NonNull Object elseValue
)
```

Creates a conditional expression that evaluates to a `thenValue` if a condition is true or an `elseValue` if the condition is false.

```
// If the 'quantity' field is greater than 10, return "High", otherwise return "Low"
conditional(field("quantity").greaterThan(10), "High", "Low")
```

| Parameters |
|---|---|
| `@NonNull BooleanExpression condition` | The condition to evaluate. |
| `@NonNull Object thenValue` | Value if the condition is true. |
| `@NonNull Object elseValue` | Value if the condition is false. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the conditional operation. |

### constant

```
public static final @NonNull Expression constant(@NonNull DocumentReference ref)
```

Create a constant for a `DocumentReference` value.

```
// val firestore = FirebaseFirestore.getInstance()
// val docRef = firestore.collection("cities").document("SF")
// constant(docRef)
```

| Parameters |
|---|---|
| `@NonNull DocumentReference ref` | The `DocumentReference` value. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` constant instance. |

### constant

```
public static final @NonNull Expression constant(@NonNull Blob value)
```

Create a constant for a `Blob` value.

```
// Create a constant with a Blob
constant(Blob.fromBytes(byteArrayOf(0x48, 0x65, 0x6c, 0x6c, 0x6f))) // "Hello"
```

| Parameters |
|---|---|
| `@NonNull Blob value` | The `Blob` value. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` constant instance. |

### constant

```
public static final @NonNull BooleanExpression constant(boolean value)
```

Create a constant for a `Boolean` value.

```
// Create a constant with the value true
constant(true)
```

| Parameters |
|---|---|
| `boolean value` | The `Boolean` value. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` constant instance. |

### constant

```
public static final @NonNull Expression constant(@NonNull byte[] value)
```

Create a constant for a bytes value.

```
// Create a constant with a byte array
constant(byteArrayOf(0x48, 0x65, 0x6c, 0x6c, 0x6f)) // "Hello"
```

| Parameters |
|---|---|
| `@NonNull byte[] value` | The bytes value. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` constant instance. |

### constant

```
public static final @NonNull Expression constant(@NonNull Date value)
```

Create a constant for a `Date` value.

```
// Create a constant with the current date
constant(Date())
```

| Parameters |
|---|---|
| `@NonNull Date value` | The `Date` value. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` constant instance. |

### constant

```
public static final @NonNull Expression constant(@NonNull GeoPoint value)
```

Create a constant for a `GeoPoint` value.

```
// Create a constant with a GeoPoint
constant(GeoPoint(37.7749, -122.4194))
```

| Parameters |
|---|---|
| `@NonNull GeoPoint value` | The `GeoPoint` value. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` constant instance. |

### constant

```
public static final @NonNull Expression constant(@NonNull Number value)
```

Create a constant for a `Number` value.

```
// Create a constant with the value 123
constant(123)
```

| Parameters |
|---|---|
| `@NonNull Number value` | The `Number` value. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` constant instance. |

### constant

```
public static final @NonNull Expression constant(@NonNull String value)
```

Create a constant for a `String` value.

```
// Create a constant with the value "hello"
constant("hello")
```

| Parameters |
|---|---|
| `@NonNull String value` | The `String` value. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` constant instance. |

### constant

```
public static final @NonNull Expression constant(@NonNull Timestamp value)
```

Create a constant for a `Timestamp` value.

```
// Create a constant with the current timestamp
constant(Timestamp.now())
```

| Parameters |
|---|---|
| `@NonNull Timestamp value` | The `Timestamp` value. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` constant instance. |

### constant

```
public static final @NonNull Expression constant(@NonNull VectorValue value)
```

Create a constant for a `VectorValue` value.

```
// Create a constant with a VectorValue
constant(VectorValue(listOf(1.0, 2.0, 3.0)))
```

| Parameters |
|---|---|
| `@NonNull VectorValue value` | The `VectorValue` value. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` constant instance. |

### cosineDistance

```
public final @NonNull Expression cosineDistance(@NonNull double[] vector)
```

Calculates the Cosine distance between this vector expression and a vector literal.

```
// Calculate the Cosine distance between the 'location' field and a target location
field("location").cosineDistance(doubleArrayOf(37.7749, -122.4194))
```

| Parameters |
|---|---|
| `@NonNull double[] vector` | The other vector (as an array of doubles) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the cosine distance between the two vectors. |

### cosineDistance

```
public final @NonNull Expression cosineDistance(@NonNull Expression vector)
```

Calculates the Cosine distance between this and another vector expressions.

```
// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field
field("userVector").cosineDistance(field("itemVector"))
```

| Parameters |
|---|---|
| `@NonNull Expression vector` | The other vector (represented as an Expression) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the cosine distance between the two vectors. |

### cosineDistance

```
public final @NonNull Expression cosineDistance(@NonNull VectorValue vector)
```

Calculates the Cosine distance between this vector expression and a vector literal.

```
// Calculate the Cosine distance between the 'location' field and a target location
field("location").cosineDistance(VectorValue.from(listOf(37.7749, -122.4194)))
```

| Parameters |
|---|---|
| `@NonNull VectorValue vector` | The other vector (represented as an `VectorValue`) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the cosine distance between the two vectors. |

### cosineDistance

```
public static final @NonNull Expression cosineDistance(@NonNull Expression vector1, @NonNull double[] vector2)
```

Calculates the Cosine distance between vector expression and a vector literal.

```
// Calculate the Cosine distance between the 'location' field and a target location
cosineDistance(field("location"), doubleArrayOf(37.7749, -122.4194))
```

| Parameters |
|---|---|
| `@NonNull Expression vector1` | The first vector (represented as an Expression) to compare against. |
| `@NonNull double[] vector2` | The other vector (as an array of doubles) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the cosine distance between the two vectors. |

### cosineDistance

```
public static final @NonNull Expression cosineDistance(@NonNull Expression vector1, @NonNull Expression vector2)
```

Calculates the Cosine distance between two vector expressions.

```
// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field
cosineDistance(field("userVector"), field("itemVector"))
```

| Parameters |
|---|---|
| `@NonNull Expression vector1` | The first vector (represented as an Expression) to compare against. |
| `@NonNull Expression vector2` | The other vector (represented as an Expression) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the cosine distance between the two vectors. |

### cosineDistance

```
public static final @NonNull Expression cosineDistance(@NonNull Expression vector1, @NonNull VectorValue vector2)
```

Calculates the Cosine distance between vector expression and a vector literal.

```
// Calculate the Cosine distance between the 'location' field and a target location
cosineDistance(field("location"), VectorValue.from(listOf(37.7749, -122.4194)))
```

| Parameters |
|---|---|
| `@NonNull Expression vector1` | The first vector (represented as an `Expression`) to compare against. |
| `@NonNull VectorValue vector2` | The other vector (represented as an `VectorValue`) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the cosine distance between the two vectors. |

### cosineDistance

```
public static final @NonNull Expression cosineDistance(@NonNull String vectorFieldName, @NonNull double[] vector)
```

Calculates the Cosine distance between a vector field and a vector literal.

```
// Calculate the Cosine distance between the 'location' field and a target location
cosineDistance("location", doubleArrayOf(37.7749, -122.4194))
```

| Parameters |
|---|---|
| `@NonNull String vectorFieldName` | The name of the field containing the first vector. |
| `@NonNull double[] vector` | The other vector (as an array of doubles) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the cosine distance between the two vectors. |

### cosineDistance

```
public static final @NonNull Expression cosineDistance(@NonNull String vectorFieldName, @NonNull Expression vector)
```

Calculates the Cosine distance between a vector field and a vector expression.

```
// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field
cosineDistance("userVector", field("itemVector"))
```

| Parameters |
|---|---|
| `@NonNull String vectorFieldName` | The name of the field containing the first vector. |
| `@NonNull Expression vector` | The other vector (represented as an Expression) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the cosine distance between the two vectors. |

### cosineDistance

```
public static final @NonNull Expression cosineDistance(
    @NonNull String vectorFieldName,
    @NonNull VectorValue vector
)
```

Calculates the Cosine distance between a vector field and a vector literal.

```
// Calculate the Cosine distance between the 'location' field and a target location
cosineDistance("location", VectorValue.from(listOf(37.7749, -122.4194)))
```

| Parameters |
|---|---|
| `@NonNull String vectorFieldName` | The name of the field containing the first vector. |
| `@NonNull VectorValue vector` | The other vector (represented as an `VectorValue`) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the cosine distance between the two vectors. |

### count

```
public final @NonNull AggregateFunction count()
```

Creates an aggregation that counts the number of stage inputs with valid evaluations of the this expression.

| Returns |
|---|---|
| `@NonNull AggregateFunction` | A new `AggregateFunction` representing the count aggregation. |

### countDistinct

```
public final @NonNull AggregateFunction countDistinct()
```

Creates an aggregation that counts the number of distinct values of an expression across multiple stage inputs.

| Returns |
|---|---|
| `@NonNull AggregateFunction` | A new `AggregateFunction` representing the count distinct aggregation. |

### currentDocument

```
public static final @NonNull Expression currentDocument()
```

Creates an expression that represents the current document being processed.

Example:

```
// Define the current document as a variable "doc"
firestore.pipeline().collection("books")
    .define(currentDocument().alias("doc"))
    // Access a field from the defined document variable
    .select(variable("doc").getField("title"))
```

| Returns |
|---|---|
| `@NonNull Expression` | An `Expression` representing the current document. |

### currentTimestamp

```
public static final @NonNull Expression currentTimestamp()
```

Creates an expression that evaluates to the current server timestamp.

```
// Get the current server timestamp
currentTimestamp()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the current server timestamp. |

### descending

```
public final @NonNull Ordering descending()
```

Create an `Ordering` that sorts documents in descending order based on value of this expression

| Returns |
|---|---|
| `@NonNull Ordering` | A new `Ordering` object with descending sort by this expression. |

### divide

```
public final @NonNull Expression divide(@NonNull Expression divisor)
```

Creates an expression that divides this numeric expression by another numeric expression.

```
// Divide the 'total' field by the 'count' field
field("total").divide(field("count"))
```

| Parameters |
|---|---|
| `@NonNull Expression divisor` | Numeric expression to divide this numeric expression by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the division operation. |

### divide

```
public final @NonNull Expression divide(@NonNull Number divisor)
```

Creates an expression that divides this numeric expression by a constant.

```
// Divide the 'value' field by 10
field("value").divide(10)
```

| Parameters |
|---|---|
| `@NonNull Number divisor` | Constant to divide this expression by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the division operation. |

### divide

```
public static final @NonNull Expression divide(@NonNull Expression dividend, @NonNull Expression divisor)
```

Creates an expression that divides two numeric expressions.

```
// Divide the 'total' field by the 'count' field
divide(field("total"), field("count"))
```

| Parameters |
|---|---|
| `@NonNull Expression dividend` | The numeric expression to be divided. |
| `@NonNull Expression divisor` | The numeric expression to divide by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the division operation. |

### divide

```
public static final @NonNull Expression divide(@NonNull Expression dividend, @NonNull Number divisor)
```

Creates an expression that divides a numeric expression by a constant.

```
// Divide the 'value' field by 10
divide(field("value"), 10)
```

| Parameters |
|---|---|
| `@NonNull Expression dividend` | The numeric expression to be divided. |
| `@NonNull Number divisor` | The constant to divide by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the division operation. |

### divide

```
public static final @NonNull Expression divide(@NonNull String dividendFieldName, @NonNull Expression divisor)
```

Creates an expression that divides numeric field by a numeric expression.

```
// Divide the 'total' field by the 'count' field.
divide("total", field("count"))
```

| Parameters |
|---|---|
| `@NonNull String dividendFieldName` | The numeric field name to be divided. |
| `@NonNull Expression divisor` | The numeric expression to divide by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the divide operation. |

### divide

```
public static final @NonNull Expression divide(@NonNull String dividendFieldName, @NonNull Number divisor)
```

Creates an expression that divides a numeric field by a constant.

```
// Divide the 'total' field by 2.
divide("total", 2)
```

| Parameters |
|---|---|
| `@NonNull String dividendFieldName` | The numeric field name to be divided. |
| `@NonNull Number divisor` | The constant to divide by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the divide operation. |

### documentId

```
public final @NonNull Expression documentId()
```

Creates an expression that returns the document ID from this path expression.

```
// Get the document ID from the 'path' field
field("path").documentId()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the documentId operation. |

### documentId

```
public static final @NonNull Expression documentId(@NonNull DocumentReference docRef)
```

Creates an expression that returns the document ID from a `DocumentReference`.

| Parameters |
|---|---|
| `@NonNull DocumentReference docRef` | The `DocumentReference`. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the documentId operation. |

### documentId

```
public static final @NonNull Expression documentId(@NonNull Expression documentPath)
```

Creates an expression that returns the document ID from a path.

```
// Get the document ID from the 'path' field
documentId(field("path"))
```

| Parameters |
|---|---|
| `@NonNull Expression documentPath` | An expression the evaluates to document path. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the documentId operation. |

### documentId

```
public static final @NonNull Expression documentId(@NonNull String documentPath)
```

Creates an expression that returns the document ID from a path.

```
// Get the document ID from a path string
documentId("projects/p/databases/d/documents/c/d")
```

| Parameters |
|---|---|
| `@NonNull String documentPath` | The string representation of the document path. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the documentId operation. |

### documentMatches

```
public static final @NonNull BooleanExpression documentMatches(@NonNull String rquery)
```

Perform a full-text search on all indexed search fields in the document.

Note: This Expression can only be used within a `Search` stage.

```
db.pipeline().collection("restaurants").search(
  SearchStage(query = documentMatches("waffles OR pancakes"))
)
```

| Parameters |
|---|---|
| `@NonNull String rquery` | Define the search query using the search DSL. |

### dotProduct

```
public final @NonNull Expression dotProduct(@NonNull double[] vector)
```

Calculates the dot product distance between this vector expression and a vector literal.

```
// Calculate the dot product between the 'vector' field and a constant vector
field("vector").dotProduct(doubleArrayOf(1.0, 2.0, 3.0))
```

| Parameters |
|---|---|
| `@NonNull double[] vector` | The other vector (as an array of doubles) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the dot product distance between the two vectors. |

### dotProduct

```
public final @NonNull Expression dotProduct(@NonNull Expression vector)
```

Calculates the dot product distance between this and another vector expression.

```
// Calculate the dot product between the 'userVector' field and the 'itemVector' field
field("userVector").dotProduct(field("itemVector"))
```

| Parameters |
|---|---|
| `@NonNull Expression vector` | The other vector (represented as an Expression) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the dot product distance between the two vectors. |

### dotProduct

```
public final @NonNull Expression dotProduct(@NonNull VectorValue vector)
```

Calculates the dot product distance between this vector expression and a vector literal.

```
// Calculate the dot product between the 'vector' field and a constant vector
field("vector").dotProduct(VectorValue.from(listOf(1.0, 2.0, 3.0)))
```

| Parameters |
|---|---|
| `@NonNull VectorValue vector` | The other vector (represented as an `VectorValue`) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the dot product distance between the two vectors. |

### dotProduct

```
public static final @NonNull Expression dotProduct(@NonNull Expression vector1, @NonNull double[] vector2)
```

Calculates the dot product distance between vector expression and a vector literal.

```
// Calculate the dot product between the 'vector' field and a constant vector
dotProduct(field("vector"), doubleArrayOf(1.0, 2.0, 3.0))
```

| Parameters |
|---|---|
| `@NonNull Expression vector1` | The first vector (represented as an Expression) to compare against. |
| `@NonNull double[] vector2` | The other vector (as an array of doubles) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the dot product distance between the two vectors. |

### dotProduct

```
public static final @NonNull Expression dotProduct(@NonNull Expression vector1, @NonNull Expression vector2)
```

Calculates the dot product distance between two vector expressions.

```
// Calculate the dot product between the 'userVector' field and the 'itemVector' field
dotProduct(field("userVector"), field("itemVector"))
```

| Parameters |
|---|---|
| `@NonNull Expression vector1` | The first vector (represented as an Expression) to compare against. |
| `@NonNull Expression vector2` | The other vector (represented as an Expression) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the dot product distance between the two vectors. |

### dotProduct

```
public static final @NonNull Expression dotProduct(@NonNull Expression vector1, @NonNull VectorValue vector2)
```

Calculates the dot product distance between vector expression and a vector literal.

```
// Calculate the dot product between the 'vector' field and a constant vector
dotProduct(field("vector"), VectorValue.from(listOf(1.0, 2.0, 3.0)))
```

| Parameters |
|---|---|
| `@NonNull Expression vector1` | The first vector (represented as an `Expression`) to compare against. |
| `@NonNull VectorValue vector2` | The other vector (represented as an `VectorValue`) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the dot product distance between the two vectors. |

### dotProduct

```
public static final @NonNull Expression dotProduct(@NonNull String vectorFieldName, @NonNull double[] vector)
```

Calculates the dot product distance between vector field and a vector literal.

```
// Calculate the dot product between the 'vector' field and a constant vector
dotProduct("vector", doubleArrayOf(1.0, 2.0, 3.0))
```

| Parameters |
|---|---|
| `@NonNull String vectorFieldName` | The name of the field containing the first vector. |
| `@NonNull double[] vector` | The other vector (as an array of doubles) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the dot product distance between the two vectors. |

### dotProduct

```
public static final @NonNull Expression dotProduct(@NonNull String vectorFieldName, @NonNull Expression vector)
```

Calculates the dot product distance between a vector field and a vector expression.

```
// Calculate the dot product between the 'userVector' field and the 'itemVector' field
dotProduct("userVector", field("itemVector"))
```

| Parameters |
|---|---|
| `@NonNull String vectorFieldName` | The name of the field containing the first vector. |
| `@NonNull Expression vector` | The other vector (represented as an Expression) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the dot product distance between the two vectors. |

### dotProduct

```
public static final @NonNull Expression dotProduct(@NonNull String vectorFieldName, @NonNull VectorValue vector)
```

Calculates the dot product distance between a vector field and a vector literal.

```
// Calculate the dot product between the 'vector' field and a constant vector
dotProduct("vector", VectorValue.from(listOf(1.0, 2.0, 3.0)))
```

| Parameters |
|---|---|
| `@NonNull String vectorFieldName` | The name of the field containing the first vector. |
| `@NonNull VectorValue vector` | The other vector (represented as an `VectorValue`) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the dot product distance between the two vectors. |

### endsWith

```
public final @NonNull BooleanExpression endsWith(@NonNull Expression suffix)
```

Creates an expression that checks if this string expression ends with a given `suffix`.

```
// Check if the 'url' field ends with the value of the 'extension' field
field("url").endsWith(field("extension"))
```

| Parameters |
|---|---|
| `@NonNull Expression suffix` | The suffix string expression to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'ends with' comparison. |

### endsWith

```
public final @NonNull BooleanExpression endsWith(@NonNull String suffix)
```

Creates an expression that checks if this string expression ends with a given `suffix`.

```
// Check if the 'filename' field ends with ".txt"
field("filename").endsWith(".txt")
```

| Parameters |
|---|---|
| `@NonNull String suffix` | The suffix string to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'ends with' comparison. |

### endsWith

```
public static final @NonNull BooleanExpression endsWith(@NonNull String fieldName, @NonNull Expression suffix)
```

Creates an expression that checks if a string expression ends with a given `suffix`.

```
// Check if the 'url' field ends with the value of the 'extension' field
endsWith("url", field("extension"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of field that contains a string to check. |
| `@NonNull Expression suffix` | The suffix string expression to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'ends with' comparison. |

### endsWith

```
public static final @NonNull BooleanExpression endsWith(@NonNull String fieldName, @NonNull String suffix)
```

Creates an expression that checks if a string expression ends with a given `suffix`.

```
// Check if the 'filename' field ends with ".txt"
endsWith("filename", ".txt")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of field that contains a string to check. |
| `@NonNull String suffix` | The suffix string to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'ends with' comparison. |

### endsWith

```
public static final @NonNull BooleanExpression endsWith(@NonNull Expression stringExpr, @NonNull Expression suffix)
```

Creates an expression that checks if a string expression ends with a given `suffix`.

```
// Check if the 'url' field ends with the value of the 'extension' field
endsWith(field("url"), field("extension"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpr` | The expression to check. |
| `@NonNull Expression suffix` | The suffix string expression to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'ends with' comparison. |

### endsWith

```
public static final @NonNull BooleanExpression endsWith(@NonNull Expression stringExpr, @NonNull String suffix)
```

Creates an expression that checks if a string expression ends with a given `suffix`.

```
// Check if the 'filename' field ends with ".txt"
endsWith(field("filename"), ".txt")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpr` | The expression to check. |
| `@NonNull String suffix` | The suffix string to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'ends with' comparison. |

### equal

```
public final @NonNull BooleanExpression equal(@NonNull Expression other)
```

Creates an expression that checks if this and `other` expression are equal.

```
// Check if the 'age' field is equal to an expression
field("age").equal(field("minAge").add(10))
```

| Parameters |
|---|---|
| `@NonNull Expression other` | The expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the equality comparison. |

### equal

```
public final @NonNull BooleanExpression equal(@NonNull Object value)
```

Creates an expression that checks if this expression is equal to a `value`.

```
// Check if the 'age' field is equal to 21
field("age").equal(21)
```

| Parameters |
|---|---|
| `@NonNull Object value` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the equality comparison. |

### equal

```
public static final @NonNull BooleanExpression equal(@NonNull String fieldName, @NonNull Expression expression)
```

Creates an expression that checks if a field's value is equal to an expression.

```
// Check if the 'age' field is equal to the 'limit' field
equal("age", field("limit"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to compare. |
| `@NonNull Expression expression` | The expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the equality comparison. |

### equal

```
public static final @NonNull BooleanExpression equal(@NonNull String fieldName, @NonNull Object value)
```

Creates an expression that checks if a field's value is equal to another value.

```
// Check if the 'city' field is equal to string constant "London"
equal("city", "London")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to compare. |
| `@NonNull Object value` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the equality comparison. |

### equal

```
public static final @NonNull BooleanExpression equal(@NonNull Expression left, @NonNull Object right)
```

Creates an expression that checks if an expression is equal to a value.

```
// Check if the 'age' field is equal to 21
equal(field("age"), 21)
```

| Parameters |
|---|---|
| `@NonNull Expression left` | The first expression to compare. |
| `@NonNull Object right` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the equality comparison. |

### equal

```
public static final @NonNull BooleanExpression equal(@NonNull Expression left, @NonNull Expression right)
```

Creates an expression that checks if two expressions are equal.

```
// Check if the 'age' field is equal to an expression
equal(field("age"), field("minAge").add(10))
```

| Parameters |
|---|---|
| `@NonNull Expression left` | The first expression to compare. |
| `@NonNull Expression right` | The second expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the equality comparison. |

### equalAny

```
public final @NonNull BooleanExpression equalAny(@NonNull Expression arrayExpression)
```

Creates an expression that checks if this expression, when evaluated, is equal to any of the elements of `arrayExpression`.

```
// Check if the 'category' field is in the 'availableCategories' array field.
field("category").equalAny(field("availableCategories"))
```

| Parameters |
|---|---|
| `@NonNull Expression arrayExpression` | An expression that evaluates to an array, whose elements to check for equality to the input. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'IN' comparison. |

### equalAny

```
public final @NonNull BooleanExpression equalAny(@NonNull List<@NonNull Object> values)
```

Creates an expression that checks if this expression, when evaluated, is equal to any of the provided `values`.

```
// Check if the 'category' field is either "Electronics" or the value of the 'primaryType' field.
field("category").equalAny(listOf("Electronics", field("primaryType")))
```

| Parameters |
|---|---|
| `@NonNull List<@NonNull Object> values` | The values to check against. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'IN' comparison. |

### equalAny

```
public static final @NonNull BooleanExpression equalAny(
    @NonNull Expression expression,
    @NonNull Expression arrayExpression
)
```

Creates an expression that checks if an `expression`, when evaluated, is equal to any of the elements of `arrayExpression`.

```
// Check if the 'category' field is in the 'availableCategories' array field.
equalAny(field("category"), field("availableCategories"))
```

| Parameters |
|---|---|
| `@NonNull Expression expression` | The expression whose results to compare. |
| `@NonNull Expression arrayExpression` | An expression that evaluates to an array, whose elements to check for equality to the input. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'IN' comparison. |

### equalAny

```
public static final @NonNull BooleanExpression equalAny(
    @NonNull Expression expression,
    @NonNull List<@NonNull Object> values
)
```

Creates an expression that checks if an `expression`, when evaluated, is equal to any of the provided `values`.

```
// Check if the 'category' field is either "Electronics" or the value of the 'primaryType' field.
equalAny(field("category"), listOf("Electronics", field("primaryType")))
```

| Parameters |
|---|---|
| `@NonNull Expression expression` | The expression whose results to compare. |
| `@NonNull List<@NonNull Object> values` | The values to check against. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'IN' comparison. |

### equalAny

```
public static final @NonNull BooleanExpression equalAny(@NonNull String fieldName, @NonNull Expression arrayExpression)
```

Creates an expression that checks if a field's value is equal to any of the elements of `arrayExpression`.

```
// Check if the 'category' field is in the 'availableCategories' array field.
equalAny("category", field("availableCategories"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field to compare. |
| `@NonNull Expression arrayExpression` | An expression that evaluates to an array, whose elements to check for equality to the input. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'IN' comparison. |

### equalAny

```
public static final @NonNull BooleanExpression equalAny(@NonNull String fieldName, @NonNull List<@NonNull Object> values)
```

Creates an expression that checks if a field's value is equal to any of the provided `values` .

```
// Check if the 'category' field is either "Electronics" or "Apparel".
equalAny("category", listOf("Electronics", "Apparel"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field to compare. |
| `@NonNull List<@NonNull Object> values` | The values to check against. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'IN' comparison. |

### euclideanDistance

```
public final @NonNull Expression euclideanDistance(@NonNull double[] vector)
```

Calculates the Euclidean distance between this vector expression and a vector literal.

```
// Calculate the Euclidean distance between the 'vector' field and a constant vector
field("vector").euclideanDistance(doubleArrayOf(1.0, 2.0, 3.0))
```

| Parameters |
|---|---|
| `@NonNull double[] vector` | The other vector (as an array of doubles) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the Euclidean distance between the two vectors. |

### euclideanDistance

```
public final @NonNull Expression euclideanDistance(@NonNull Expression vector)
```

Calculates the Euclidean distance between this and another vector expression.

```
// Calculate the Euclidean distance between the 'userVector' field and the 'itemVector' field
field("userVector").euclideanDistance(field("itemVector"))
```

| Parameters |
|---|---|
| `@NonNull Expression vector` | The other vector (represented as an Expression) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the Euclidean distance between the two vectors. |

### euclideanDistance

```
public final @NonNull Expression euclideanDistance(@NonNull VectorValue vector)
```

Calculates the Euclidean distance between this vector expression and a vector literal.

```
// Calculate the Euclidean distance between the 'vector' field and a constant vector
field("vector").euclideanDistance(VectorValue.from(listOf(1.0, 2.0, 3.0)))
```

| Parameters |
|---|---|
| `@NonNull VectorValue vector` | The other vector (represented as an `VectorValue`) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the Euclidean distance between the two vectors. |

### euclideanDistance

```
public static final @NonNull Expression euclideanDistance(@NonNull Expression vector1, @NonNull double[] vector2)
```

Calculates the Euclidean distance between vector expression and a vector literal.

```
// Calculate the Euclidean distance between the 'vector' field and a constant vector
euclideanDistance(field("vector"), doubleArrayOf(1.0, 2.0, 3.0))
```

| Parameters |
|---|---|
| `@NonNull Expression vector1` | The first vector (represented as an Expression) to compare against. |
| `@NonNull double[] vector2` | The other vector (as an array of doubles) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the Euclidean distance between the two vectors. |

### euclideanDistance

```
public static final @NonNull Expression euclideanDistance(@NonNull Expression vector1, @NonNull Expression vector2)
```

Calculates the Euclidean distance between two vector expressions.

```
// Calculate the Euclidean distance between the 'userVector' field and the 'itemVector' field
euclideanDistance(field("userVector"), field("itemVector"))
```

| Parameters |
|---|---|
| `@NonNull Expression vector1` | The first vector (represented as an Expression) to compare against. |
| `@NonNull Expression vector2` | The other vector (represented as an Expression) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the Euclidean distance between the two vectors. |

### euclideanDistance

```
public static final @NonNull Expression euclideanDistance(
    @NonNull Expression vector1,
    @NonNull VectorValue vector2
)
```

Calculates the Euclidean distance between vector expression and a vector literal.

```
// Calculate the Euclidean distance between the 'vector' field and a constant vector
euclideanDistance(field("vector"), VectorValue.from(listOf(1.0, 2.0, 3.0)))
```

| Parameters |
|---|---|
| `@NonNull Expression vector1` | The first vector (represented as an `Expression`) to compare against. |
| `@NonNull VectorValue vector2` | The other vector (represented as an `VectorValue`) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the Euclidean distance between the two vectors. |

### euclideanDistance

```
public static final @NonNull Expression euclideanDistance(
    @NonNull String vectorFieldName,
    @NonNull double[] vector
)
```

Calculates the Euclidean distance between a vector field and a vector literal.

```
// Calculate the Euclidean distance between the 'vector' field and a constant vector
euclideanDistance("vector", doubleArrayOf(1.0, 2.0, 3.0))
```

| Parameters |
|---|---|
| `@NonNull String vectorFieldName` | The name of the field containing the first vector. |
| `@NonNull double[] vector` | The other vector (as an array of doubles) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the Euclidean distance between the two vectors. |

### euclideanDistance

```
public static final @NonNull Expression euclideanDistance(
    @NonNull String vectorFieldName,
    @NonNull Expression vector
)
```

Calculates the Euclidean distance between a vector field and a vector expression.

```
// Calculate the Euclidean distance between the 'userVector' field and the 'itemVector' field
euclideanDistance("userVector", field("itemVector"))
```

| Parameters |
|---|---|
| `@NonNull String vectorFieldName` | The name of the field containing the first vector. |
| `@NonNull Expression vector` | The other vector (represented as an Expression) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the Euclidean distance between the two vectors. |

### euclideanDistance

```
public static final @NonNull Expression euclideanDistance(
    @NonNull String vectorFieldName,
    @NonNull VectorValue vector
)
```

Calculates the Euclidean distance between a vector field and a vector literal.

```
// Calculate the Euclidean distance between the 'vector' field and a constant vector
euclideanDistance("vector", VectorValue.from(listOf(1.0, 2.0, 3.0)))
```

| Parameters |
|---|---|
| `@NonNull String vectorFieldName` | The name of the field containing the first vector. |
| `@NonNull VectorValue vector` | The other vector (represented as an `VectorValue`) to compare against. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the Euclidean distance between the two vectors. |

### exists

```
public final @NonNull BooleanExpression exists()
```

Creates an expression that checks if this expression evaluates to a name of the field that exists.

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `Expression` representing the exists check. |

### exists

```
public static final @NonNull BooleanExpression exists(@NonNull String fieldName)
```

Creates an expression that checks if a field exists.

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to check. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `Expression` representing the exists check. |

### exists

```
public static final @NonNull BooleanExpression exists(@NonNull Expression value)
```

Creates an expression that checks if a field exists.

| Parameters |
|---|---|
| `@NonNull Expression value` | An expression evaluates to the name of the field to check. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `Expression` representing the exists check. |

### exp

```
public final @NonNull Expression exp()
```

Creates an expression that returns Euler's number e raised to the power of this expression.

```
// Compute e to the power of the 'value' field.
field("value").exp()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the exponentiation. |

### exp

```
public static final @NonNull Expression exp(@NonNull Expression numericExpr)
```

Creates an expression that returns Euler's number e raised to the power of `numericExpr`.

```
// Compute e to the power of the 'value' field.
exp(field("value"))
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the exponentiation. |

### exp

```
public static final @NonNull Expression exp(@NonNull String numericField)
```

Creates an expression that returns Euler's number e raised to the power of `numericField`.

```
// Compute e to the power of the 'value' field.
exp("value")
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the exponentiation. |

### field

```
public static final @NonNull Field field(@NonNull FieldPath fieldPath)
```

Creates a `Field` instance representing the field at the given path.

The path can be a simple field name (for example, "name") or a dot-separated path to a nested field (for example, "address.city").

```
// Get the 'address.city' field
field(FieldPath.of("address", "city"))
```

| Parameters |
|---|---|
| `@NonNull FieldPath fieldPath` | The `FieldPath` to the field. |

| Returns |
|---|---|
| `@NonNull Field` | A new `Field` instance representing the specified path. |

### field

```
public static final @NonNull Field field(@NonNull String name)
```

Creates a `Field` instance representing the field at the given path.

The path can be a simple field name (for example, "name") or a dot-separated path to a nested field (for example, "address.city").

| Parameters |
|---|---|
| `@NonNull String name` | The path to the field. |

| Returns |
|---|---|
| `@NonNull Field` | A new `Field` instance representing the specified path. |

### first

```
public final @NonNull AggregateFunction first()
```

Creates an aggregation that finds the first value of this expression across multiple stage inputs.

| Returns |
|---|---|
| `@NonNull AggregateFunction` | A new `AggregateFunction` representing the first aggregation. |

### floor

```
public final @NonNull Expression floor()
```

Creates an expression that returns the largest integer that is not greater than this numeric expression.

```
// Compute the floor of the 'price' field.
field("price").floor()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing an integer result from the floor operation. |

### floor

```
public static final @NonNull Expression floor(@NonNull Expression numericExpr)
```

Creates an expression that returns the largest integer that is not greater than `numericExpr`

```
// Compute the floor of the 'price' field.
floor(field("price"))
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing an integer result from the floor operation. |

### floor

```
public static final @NonNull Expression floor(@NonNull String numericField)
```

Creates an expression that returns the largest integer that is not greater than `numericField`.

```
// Compute the floor of the 'price' field.
floor("price")
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing an integer result from the floor operation. |

### geoDistance

```
public static final @NonNull Expression geoDistance(@NonNull Field field, @NonNull GeoPoint location)
```

Evaluates to the distance in meters between the location in the specified field and the query location.

Note: This Expression can only be used within a `Search` stage.

```
db.pipeline().collection("restaurants").search(
  SearchStage(query = documentMatches("waffles"), sort = arrayOf(geoDistance(field("location"), GeoPoint(37.0, -122.0)).ascending()))
)
```

| Parameters |
|---|---|
| `@NonNull Field field` | Specifies the field in the document which contains the first GeoPoint for distance computation. |
| `@NonNull GeoPoint location` | Compute distance to this GeoPoint. |

### geoDistance

```
public static final @NonNull Expression geoDistance(@NonNull String fieldName, @NonNull GeoPoint location)
```

Evaluates to the distance in meters between the location in the specified field and the query location.

Note: This Expression can only be used within a `Search` stage.

```
db.pipeline().collection("restaurants").search(
  SearchStage(query = documentMatches("waffles"), sort = arrayOf(geoDistance("location", GeoPoint(37.0, -122.0)).ascending()))
)
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | Specifies the field in the document which contains the first GeoPoint for distance computation. |
| `@NonNull GeoPoint location` | Compute distance to this GeoPoint. |

### getField

```
public final @NonNull Expression getField(@NonNull String key)
```

Accesses a field/property of a document or Map using the provided `key`.

| Parameters |
|---|---|
| `@NonNull String key` | The string key to access. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the value of the field. |

### getField

```
public final @NonNull Expression getField(@NonNull Expression keyExpression)
```

Accesses a field/property of a document or Map using the provided `keyExpression`.

| Parameters |
|---|---|
| `@NonNull Expression keyExpression` | The expression evaluating to the key to access. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the value of the field. |

### getField

```
public static final @NonNull Expression getField(@NonNull Expression expression, @NonNull String key)
```

Accesses a field/property of a document or Map using the provided `key`.

| Parameters |
|---|---|
| `@NonNull Expression expression` | The expression evaluating to a map or document. |
| `@NonNull String key` | The key of the field to access. |

| Returns |
|---|---|
| `@NonNull Expression` | An `Expression` representing the value of the field. |

### getField

```
public static final @NonNull Expression getField(@NonNull Expression expression, @NonNull Expression keyExpression)
```

Accesses a field/property of a document or Map using the provided `keyExpression`.

| Parameters |
|---|---|
| `@NonNull Expression expression` | The expression evaluating to a Map or Document. |
| `@NonNull Expression keyExpression` | The expression evaluating to the key. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the value of the field. |

### getField

```
public static final @NonNull Expression getField(@NonNull String fieldName, @NonNull String key)
```

Accesses a field/property of a document or Map using the provided `key`.

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name of the map or document field. |
| `@NonNull String key` | The key of the field to access. |

| Returns |
|---|---|
| `@NonNull Expression` | An `Expression` representing the value of the field. |

### getField

```
public static final @NonNull Expression getField(@NonNull String fieldName, @NonNull Expression keyExpression)
```

Accesses a field/property of a document or Map using the provided `keyExpression`.

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name of the map or document field. |
| `@NonNull Expression keyExpression` | The expression evaluating to the key. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the value of the field. |

### greaterThan

```
public final @NonNull BooleanExpression greaterThan(@NonNull Expression other)
```

Creates an expression that checks if this expression is greater than the `other` expression.

```
// Check if the 'age' field is greater than the 'limit' field
field("age").greaterThan(field("limit"))
```

| Parameters |
|---|---|
| `@NonNull Expression other` | The expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the greater than comparison. |

### greaterThan

```
public final @NonNull BooleanExpression greaterThan(@NonNull Object value)
```

Creates an expression that checks if this expression is greater than a `value`.

```
// Check if the 'price' field is greater than 100
field("price").greaterThan(100)
```

| Parameters |
|---|---|
| `@NonNull Object value` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the greater than comparison. |

### greaterThan

```
public static final @NonNull BooleanExpression greaterThan(@NonNull String fieldName, @NonNull Expression expression)
```

Creates an expression that checks if a field's value is greater than an expression.

```
// Check if the 'age' field is greater than the 'limit' field
greaterThan("age", field("limit"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to compare. |
| `@NonNull Expression expression` | The expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the greater than comparison. |

### greaterThan

```
public static final @NonNull BooleanExpression greaterThan(@NonNull String fieldName, @NonNull Object value)
```

Creates an expression that checks if a field's value is greater than another value.

```
// Check if the 'price' field is greater than 100
greaterThan("price", 100)
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to compare. |
| `@NonNull Object value` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the greater than comparison. |

### greaterThan

```
public static final @NonNull BooleanExpression greaterThan(@NonNull Expression left, @NonNull Object right)
```

Creates an expression that checks if an expression is greater than a value.

```
// Check if the 'price' field is greater than 100
greaterThan(field("price"), 100)
```

| Parameters |
|---|---|
| `@NonNull Expression left` | The first expression to compare. |
| `@NonNull Object right` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the greater than comparison. |

### greaterThan

```
public static final @NonNull BooleanExpression greaterThan(@NonNull Expression left, @NonNull Expression right)
```

Creates an expression that checks if the first expression is greater than the second expression.

```
// Check if the 'age' field is greater than the 'limit' field
greaterThan(field("age"), field("limit"))
```

| Parameters |
|---|---|
| `@NonNull Expression left` | The first expression to compare. |
| `@NonNull Expression right` | The second expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the greater than comparison. |

### greaterThanOrEqual

```
public final @NonNull BooleanExpression greaterThanOrEqual(@NonNull Expression other)
```

Creates an expression that checks if this expression is greater than or equal to the `other` expression.

```
// Check if the 'quantity' field is greater than or equal to field 'requirement' plus 1
field("quantity").greaterThanOrEqual(field("requirement").add(1))
```

| Parameters |
|---|---|
| `@NonNull Expression other` | The expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the greater than or equal to comparison. |

### greaterThanOrEqual

```
public final @NonNull BooleanExpression greaterThanOrEqual(@NonNull Object value)
```

Creates an expression that checks if this expression is greater than or equal to a `value`.

```
// Check if the 'score' field is greater than or equal to 80
field("score").greaterThanOrEqual(80)
```

| Parameters |
|---|---|
| `@NonNull Object value` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the greater than or equal to comparison. |

### greaterThanOrEqual

```
public static final @NonNull BooleanExpression greaterThanOrEqual(
    @NonNull String fieldName,
    @NonNull Expression expression
)
```

Creates an expression that checks if a field's value is greater than or equal to an expression.

```
// Check if the 'quantity' field is greater than or equal to field 'requirement' plus 1
greaterThanOrEqual("quantity", field("requirement").add(1))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to compare. |
| `@NonNull Expression expression` | The expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the greater than or equal to comparison. |

### greaterThanOrEqual

```
public static final @NonNull BooleanExpression greaterThanOrEqual(@NonNull String fieldName, @NonNull Object value)
```

Creates an expression that checks if a field's value is greater than or equal to another value.

```
// Check if the 'score' field is greater than or equal to 80
greaterThanOrEqual("score", 80)
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to compare. |
| `@NonNull Object value` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the greater than or equal to comparison. |

### greaterThanOrEqual

```
public static final @NonNull BooleanExpression greaterThanOrEqual(@NonNull Expression left, @NonNull Object right)
```

Creates an expression that checks if an expression is greater than or equal to a value.

```
// Check if the 'score' field is greater than or equal to 80
greaterThanOrEqual(field("score"), 80)
```

| Parameters |
|---|---|
| `@NonNull Expression left` | The first expression to compare. |
| `@NonNull Object right` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the greater than or equal to comparison. |

### greaterThanOrEqual

```
public static final @NonNull BooleanExpression greaterThanOrEqual(@NonNull Expression left, @NonNull Expression right)
```

Creates an expression that checks if the first expression is greater than or equal to the second expression.

```
// Check if the 'quantity' field is greater than or equal to field 'requirement' plus 1
greaterThanOrEqual(field("quantity"), field("requirement").add(1))
```

| Parameters |
|---|---|
| `@NonNull Expression left` | The first expression to compare. |
| `@NonNull Expression right` | The second expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the greater than or equal to comparison. |

### ifAbsent

```
public final @NonNull Expression ifAbsent(@NonNull Expression elseExpr)
```

Creates an expression that returns the `elseExpr` argument if this expression is absent, else return the result of this expression.

```
// Returns the value of the optional field 'optional_field', or returns 'default_value'
// if the field is absent.
field("optional_field").ifAbsent("default_value")
```

| Parameters |
|---|---|
| `@NonNull Expression elseExpr` | The expression that will be evaluated and returned if this expression is absent. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifAbsent operation. |

### ifAbsent

```
public final @NonNull Expression ifAbsent(@NonNull Object elseValue)
```

Creates an expression that returns the `elseValue` argument if this expression is absent, else return the result of this expression.

```
// Returns the value of the optional field 'optional_field', or returns 'default_value'
// if the field is absent.
field("optional_field").ifAbsent("default_value")
```

| Parameters |
|---|---|
| `@NonNull Object elseValue` | The value that will be returned if this expression is absent. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifAbsent operation. |

### ifAbsent

```
public static final @NonNull Expression ifAbsent(@NonNull Expression ifExpr, @NonNull Expression elseExpr)
```

Creates an expression that returns the `elseExpr` argument if `ifExpr` is absent, else return the result of the `ifExpr` argument evaluation.

```
// Returns the value of the optional field 'optional_field', or returns 'default_value'
// if the field is absent.
ifAbsent(field("optional_field"), "default_value")
```

| Parameters |
|---|---|
| `@NonNull Expression ifExpr` | The expression to check for absence. |
| `@NonNull Expression elseExpr` | The expression that will be evaluated and returned if `ifExpr` is absent. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifAbsent operation. |

### ifAbsent

```
public static final @NonNull Expression ifAbsent(@NonNull Expression ifExpr, @NonNull Object elseValue)
```

Creates an expression that returns the `elseValue` argument if `ifExpr` is absent, else return the result of the `ifExpr` argument evaluation.

```
// Returns the value of the optional field 'optional_field', or returns 'default_value'
// if the field is absent.
ifAbsent(field("optional_field"), "default_value")
```

| Parameters |
|---|---|
| `@NonNull Expression ifExpr` | The expression to check for absence. |
| `@NonNull Object elseValue` | The value that will be returned if `ifExpr` is absent. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifAbsent operation. |

### ifAbsent

```
public static final @NonNull Expression ifAbsent(@NonNull String ifFieldName, @NonNull Expression elseExpr)
```

Creates an expression that returns the `elseExpr` argument if `ifFieldName` is absent, else return the value of the field.

```
// Returns the value of the optional field 'optional_field', or returns the value of
// 'default_field' if 'optional_field' is absent.
ifAbsent("optional_field", field("default_field"))
```

| Parameters |
|---|---|
| `@NonNull String ifFieldName` | The field to check for absence. |
| `@NonNull Expression elseExpr` | The expression that will be evaluated and returned if `ifFieldName` is absent. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifAbsent operation. |

### ifAbsent

```
public static final @NonNull Expression ifAbsent(@NonNull String ifFieldName, @NonNull Object elseValue)
```

Creates an expression that returns the `elseValue` argument if `ifFieldName` is absent, else return the value of the field.

```
// Returns the value of the optional field 'optional_field', or returns 'default_value'
// if the field is absent.
ifAbsent("optional_field", "default_value")
```

| Parameters |
|---|---|
| `@NonNull String ifFieldName` | The field to check for absence. |
| `@NonNull Object elseValue` | The value that will be returned if `ifFieldName` is absent. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifAbsent operation. |

### ifError

```
public final @NonNull Expression ifError(@NonNull Expression catchExpr)
```

Creates an expression that returns the `catchExpr` argument if there is an error, else return the result of this expression.

```
// Returns the first item in the title field arrays, or returns
// the entire title field if the array is empty or the field is another type.
arrayGet(field("title"), 0).ifError(field("title"))
```

| Parameters |
|---|---|
| `@NonNull Expression catchExpr` | The catch expression that will be evaluated and returned if the this expression produces an error. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifError operation. |

### ifError

```
public final @NonNull Expression ifError(@NonNull Object catchValue)
```

Creates an expression that returns the `catchValue` argument if there is an error, else return the result of this expression.

```
// Returns the first item in the title field arrays, or returns "Default Title"
arrayGet(field("title"), 0).ifError("Default Title")
```

| Parameters |
|---|---|
| `@NonNull Object catchValue` | The value that will be returned if this expression produces an error. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifError operation. |

### ifError

```
public static final @NonNull BooleanExpression ifError(
    @NonNull BooleanExpression tryExpr,
    @NonNull 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`.

```
// Returns the result of the boolean expression, or false if it errors.
ifError(field("is_premium"), false)
```

| Parameters |
|---|---|
| `@NonNull BooleanExpression tryExpr` | The try boolean expression. |
| `@NonNull BooleanExpression catchExpr` | The catch boolean expression that will be evaluated and returned if the `tryExpr` produces an error. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the ifError operation. |

### ifError

```
public static final @NonNull Expression ifError(@NonNull Expression tryExpr, @NonNull Expression catchExpr)
```

Creates an expression that returns the `catchExpr` argument if there is an error, else return the result of the `tryExpr` argument evaluation.

```
// Returns the first item in the title field arrays, or returns
// the entire title field if the array is empty or the field is another type.
ifError(arrayGet(field("title"), 0), field("title"))
```

| Parameters |
|---|---|
| `@NonNull Expression tryExpr` | The try expression. |
| `@NonNull Expression catchExpr` | The catch expression that will be evaluated and returned if the `tryExpr` produces an error. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifError operation. |

### ifError

```
public static final @NonNull Expression ifError(@NonNull Expression tryExpr, @NonNull Object catchValue)
```

Creates an expression that returns the `catchValue` argument if there is an error, else return the result of the `tryExpr` argument evaluation.

```
// Returns the first item in the title field arrays, or returns "Default Title"
ifError(arrayGet(field("title"), 0), "Default Title")
```

| Parameters |
|---|---|
| `@NonNull Expression tryExpr` | The try expression. |
| `@NonNull Object catchValue` | The value that will be returned if the `tryExpr` produces an error. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifError operation. |

### ifNull

```
public final @NonNull Expression ifNull(@NonNull Expression elseExpression)
```

Creates an expression that returns the `elseExpression` argument if this expression evaluates to null, else return the result of this expression.

This function provides a fallback for both absent and explicit null values. In contrast, `ifAbsent` only triggers for missing fields.

```
// Returns the user's preferred name, or if that is null, returns their full name.
field("preferredName").ifNull(field("fullName"))
```

| Parameters |
|---|---|
| `@NonNull Expression elseExpression` | The expression that will be evaluated and returned if this expression is null. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifNull operation. |

### ifNull

```
public final @NonNull Expression ifNull(@NonNull Object elseValue)
```

Creates an expression that returns the `elseValue` argument if this expression evaluates to null, else return the result of this expression.

This function provides a fallback for both absent and explicit null values. In contrast, `ifAbsent` only triggers for missing fields.

```
// Returns the user's display name, or returns "Anonymous" if the field is null.
field("displayName").ifNull("Anonymous")
```

| Parameters |
|---|---|
| `@NonNull Object elseValue` | The value that will be returned if this expression evaluates to null. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifNull operation. |

### ifNull

```
public static final @NonNull Expression ifNull(@NonNull Expression ifExpr, @NonNull Expression elseExpr)
```

Creates an expression that returns the `elseExpr` argument if `ifExpr` evaluates to null, else return the result of the `ifExpr` argument evaluation.

This function provides a fallback for both absent and explicit null values. In contrast, `ifAbsent` only triggers for missing fields.

```
// Returns the user's preferred name, or if that is null, returns their full name.
ifNull(field("preferredName"), field("fullName"))
```

| Parameters |
|---|---|
| `@NonNull Expression ifExpr` | The expression to check for null. |
| `@NonNull Expression elseExpr` | The expression that will be evaluated and returned if `ifExpr` is null. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifNull operation. |

### ifNull

```
public static final @NonNull Expression ifNull(@NonNull Expression ifExpr, @NonNull Object elseValue)
```

Creates an expression that returns the `elseValue` argument if `ifExpr` evaluates to null, else return the result of the `ifExpr` argument evaluation.

This function provides a fallback for both absent and explicit null values. In contrast, `ifAbsent` only triggers for missing fields.

```
// Returns the user's display name, or returns "Anonymous" if the field is null.
ifNull(field("displayName"), "Anonymous")
```

| Parameters |
|---|---|
| `@NonNull Expression ifExpr` | The expression to check for null. |
| `@NonNull Object elseValue` | The value that will be returned if `ifExpr` evaluates to null. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifNull operation. |

### ifNull

```
public static final @NonNull Expression ifNull(@NonNull String ifFieldName, @NonNull Expression elseExpr)
```

Creates an expression that returns the `elseExpr` argument if `ifFieldName` field is null, else return the value of the field.

```
// Returns the user's preferred name, or if that is null, returns their full name.
ifNull("preferredName", field("fullName"))
```

| Parameters |
|---|---|
| `@NonNull String ifFieldName` | The field to check for null. |
| `@NonNull Expression elseExpr` | The expression that will be evaluated and returned if `ifFieldName` is null. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifNull operation. |

### ifNull

```
public static final @NonNull Expression ifNull(@NonNull String ifFieldName, @NonNull Object elseValue)
```

Creates an expression that returns the `elseValue` argument if `ifFieldName` field is null, else return the value of the field.

```
// Returns the user's display name, or returns "Anonymous" if the field is null.
ifNull("displayName", "Anonymous")
```

| Parameters |
|---|---|
| `@NonNull String ifFieldName` | The field to check for null. |
| `@NonNull Object elseValue` | The value that will be returned if `ifFieldName` is null. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ifNull operation. |

### isAbsent

```
public final @NonNull BooleanExpression isAbsent()
```

Creates an expression that returns true if the result of this expression is absent. Otherwise, returns false even if the value is null.

```
// Check if the field `value` is absent.
field("value").isAbsent()
```

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the isAbsent operation. |

### isAbsent

```
public static final @NonNull BooleanExpression isAbsent(@NonNull String fieldName)
```

Creates an expression that returns true if a field is absent. Otherwise, returns false even if the field value is null.

```
// Check if the field `value` is absent.
isAbsent("value")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field to check. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the isAbsent operation. |

### isAbsent

```
public static final @NonNull BooleanExpression isAbsent(@NonNull Expression value)
```

Creates an expression that returns true if a value is absent. Otherwise, returns false even if the value is null.

```
// Check if the field `value` is absent.
isAbsent(field("value"))
```

| Parameters |
|---|---|
| `@NonNull Expression value` | The expression to check. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the isAbsent operation. |

### isError

```
public final @NonNull BooleanExpression isError()
```

Creates an expression that checks if this expression produces an error.

```
// Check if the result of a calculation is an error
arrayContains(field("title"), 1).isError()
```

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the `isError` check. |

### isError

```
public static final @NonNull BooleanExpression isError(@NonNull Expression expr)
```

Creates an expression that checks if a given expression produces an error.

```
// Check if the result of a calculation is an error
isError(arrayContains(field("title"), 1))
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The expression to check. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the `isError` check. |

### isType

```
public final @NonNull BooleanExpression isType(@NonNull String type)
```

Creates an expression that checks if the result of this expression is of the given type.

Supported values for `type` are: "null", "array", "boolean", "bytes", "timestamp", "geo_point", "number", "int32", "int64", "float64", "decimal128", "map", "reference", "string", "vector", "max_key", "min_key", "object_id", "regex", and "request_timestamp".

```
// Check if the 'age' field is an integer
field("age").isType("int64")
```

| Parameters |
|---|---|
| `@NonNull String type` | The type to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` that evaluates to true if the expression's result is of the given type, false otherwise. |

### isType

```
public static final @NonNull BooleanExpression isType(@NonNull Expression expr, @NonNull String type)
```

Creates an expression that checks if the result of an expression is of the given type.

Supported values for `type` are: "null", "array", "boolean", "bytes", "timestamp", "geo_point", "number", "int32", "int64", "float64", "decimal128", "map", "reference", "string", "vector", "max_key", "min_key", "object_id", "regex", and "request_timestamp".

```
// Check if the 'age' field is an integer
isType(field("age"), "int64")
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The expression to check the type of. |
| `@NonNull String type` | The type to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` that evaluates to true if the expression's result is of the given type, false otherwise. |

### isType

```
public static final @NonNull BooleanExpression isType(@NonNull String fieldName, @NonNull String type)
```

Creates an expression that checks if the value of a field is of the given type.

Supported values for `type` are: "null", "array", "boolean", "bytes", "timestamp", "geo_point", "number", "int32", "int64", "float64", "decimal128", "map", "reference", "string", "vector", "max_key", "min_key", "object_id", "regex", and "request_timestamp".

```
// Check if the 'age' field is an integer
isType("age", "int64")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field to check the type of. |
| `@NonNull String type` | The type to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` that evaluates to true if the expression's result is of the given type, false otherwise. |

### join

```
public final @NonNull Expression join(@NonNull String delimiter)
```

Creates an expression that joins the elements of an array into a string.

```
// Join the elements of the 'tags' field with a comma and space.
field("tags").join(", ")
```

| Parameters |
|---|---|
| `@NonNull String delimiter` | The string to use as a delimiter. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the join operation. |

### join

```
public final @NonNull Expression join(@NonNull Expression delimiterExpression)
```

Creates an expression that joins the elements of an array into a string.

```
// Join the elements of the 'tags' field with the delimiter from the 'separator' field.
field("tags").join(field("separator"))
```

| Parameters |
|---|---|
| `@NonNull Expression delimiterExpression` | The expression that evaluates to the delimiter string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the join operation. |

### join

```
public static final @NonNull Expression join(@NonNull Expression arrayExpression, @NonNull String delimiter)
```

Creates an expression that joins the elements of an array into a string.

```
// Join the elements of the 'tags' field with a comma and space.
join(field("tags"), ", ")
```

| Parameters |
|---|---|
| `@NonNull Expression arrayExpression` | The expression that evaluates to an array. |
| `@NonNull String delimiter` | The string to use as a delimiter. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the join operation. |

### join

```
public static final @NonNull Expression join(
    @NonNull Expression arrayExpression,
    @NonNull Expression delimiterExpression
)
```

Creates an expression that joins the elements of an array into a string.

```
// Join the elements of the 'tags' field with the delimiter from the 'separator' field.
join(field("tags"), field("separator"))
```

| Parameters |
|---|---|
| `@NonNull Expression arrayExpression` | The expression that evaluates to an array. |
| `@NonNull Expression delimiterExpression` | The expression that evaluates to the delimiter string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the join operation. |

### join

```
public static final @NonNull Expression join(@NonNull String arrayFieldName, @NonNull String delimiter)
```

Creates an expression that joins the elements of an array field into a string.

```
// Join the elements of the 'tags' field with a comma and space.
join("tags", ", ")
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing the array. |
| `@NonNull String delimiter` | The string to use as a delimiter. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the join operation. |

### join

```
public static final @NonNull Expression join(
    @NonNull String arrayFieldName,
    @NonNull Expression delimiterExpression
)
```

Creates an expression that joins the elements of an array field into a string.

```
// Join the elements of the 'tags' field with the delimiter from the 'separator' field.
join("tags", field("separator"))
```

| Parameters |
|---|---|
| `@NonNull String arrayFieldName` | The name of the field containing the array. |
| `@NonNull Expression delimiterExpression` | The expression that evaluates to the delimiter string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the join operation. |

### last

```
public final @NonNull AggregateFunction last()
```

Creates an aggregation that finds the last value of this expression across multiple stage inputs.

| Returns |
|---|---|
| `@NonNull AggregateFunction` | A new `AggregateFunction` representing the last aggregation. |

### length

```
public final @NonNull Expression length()
```

Creates an expression that calculates the length of a string, array, map, vector, or blob expression.

```
// Get the length of the 'value' field where the value type can be any of a string, array, map, vector or blob.
field("value").length()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the length operation. |

### length

```
public static final @NonNull Expression length(@NonNull Expression expr)
```

Creates an expression that calculates the length of a string, array, map, vector, or blob expression.

```
// Get the length of the 'value' field where the value type can be any of a string, array, map, vector or blob.
length(field("value"))
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The expression representing the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the length operation. |

### length

```
public static final @NonNull Expression length(@NonNull String fieldName)
```

Creates an expression that calculates the length of a string, array, map, vector, or blob field.

```
// Get the length of the 'value' field where the value type can be any of a string, array, map, vector or blob.
charLength("value")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the length operation. |

### lessThan

```
public final @NonNull BooleanExpression lessThan(@NonNull Expression other)
```

Creates an expression that checks if this expression is less than the `other` expression.

```
// Check if the 'age' field is less than 'limit'
field("age").lessThan(field("limit"))
```

| Parameters |
|---|---|
| `@NonNull Expression other` | The expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the less than comparison. |

### lessThan

```
public final @NonNull BooleanExpression lessThan(@NonNull Object value)
```

Creates an expression that checks if this expression is less than a value.

```
// Check if the 'price' field is less than 50
field("price").lessThan(50)
```

| Parameters |
|---|---|
| `@NonNull Object value` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the less than comparison. |

### lessThan

```
public static final @NonNull BooleanExpression lessThan(@NonNull String fieldName, @NonNull Expression expression)
```

Creates an expression that checks if a field's value is less than an expression.

```
// Check if the 'age' field is less than 'limit'
lessThan("age", field("limit"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to compare. |
| `@NonNull Expression expression` | The expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the less than comparison. |

### lessThan

```
public static final @NonNull BooleanExpression lessThan(@NonNull String fieldName, @NonNull Object value)
```

Creates an expression that checks if a field's value is less than another value.

```
// Check if the 'price' field is less than 50
lessThan("price", 50)
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to compare. |
| `@NonNull Object value` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the less than comparison. |

### lessThan

```
public static final @NonNull BooleanExpression lessThan(@NonNull Expression left, @NonNull Object right)
```

Creates an expression that checks if an expression is less than a value.

```
// Check if the 'price' field is less than 50
lessThan(field("price"), 50)
```

| Parameters |
|---|---|
| `@NonNull Expression left` | The first expression to compare. |
| `@NonNull Object right` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the less than comparison. |

### lessThan

```
public static final @NonNull BooleanExpression lessThan(@NonNull Expression left, @NonNull Expression right)
```

Creates an expression that checks if the first expression is less than the second expression.

```
// Check if the 'age' field is less than 'limit'
lessThan(field("age"), field("limit"))
```

| Parameters |
|---|---|
| `@NonNull Expression left` | The first expression to compare. |
| `@NonNull Expression right` | The second expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the less than comparison. |

### lessThanOrEqual

```
public final @NonNull BooleanExpression lessThanOrEqual(@NonNull Expression other)
```

Creates an expression that checks if this expression is less than or equal to the `other` expression.

```
// Check if the 'quantity' field is less than or equal to 20
field("quantity").lessThanOrEqual(constant(20))
```

| Parameters |
|---|---|
| `@NonNull Expression other` | The expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the less than or equal to comparison. |

### lessThanOrEqual

```
public final @NonNull BooleanExpression lessThanOrEqual(@NonNull Object value)
```

Creates an expression that checks if this expression is less than or equal to a `value`.

```
// Check if the 'score' field is less than or equal to 70
field("score").lessThanOrEqual(70)
```

| Parameters |
|---|---|
| `@NonNull Object value` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the less than or equal to comparison. |

### lessThanOrEqual

```
public static final @NonNull BooleanExpression lessThanOrEqual(@NonNull String fieldName, @NonNull Expression expression)
```

Creates an expression that checks if a field's value is less than or equal to an expression.

```
// Check if the 'quantity' field is less than or equal to 20
lessThanOrEqual("quantity", constant(20))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to compare. |
| `@NonNull Expression expression` | The expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the less than or equal to comparison. |

### lessThanOrEqual

```
public static final @NonNull BooleanExpression lessThanOrEqual(@NonNull String fieldName, @NonNull Object value)
```

Creates an expression that checks if a field's value is less than or equal to another value.

```
// Check if the 'score' field is less than or equal to 70
lessThanOrEqual("score", 70)
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to compare. |
| `@NonNull Object value` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the less than or equal to comparison. |

### lessThanOrEqual

```
public static final @NonNull BooleanExpression lessThanOrEqual(@NonNull Expression left, @NonNull Object right)
```

Creates an expression that checks if an expression is less than or equal to a value.

```
// Check if the 'score' field is less than or equal to 70
lessThanOrEqual(field("score"), 70)
```

| Parameters |
|---|---|
| `@NonNull Expression left` | The first expression to compare. |
| `@NonNull Object right` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the less than or equal to comparison. |

### lessThanOrEqual

```
public static final @NonNull BooleanExpression lessThanOrEqual(@NonNull Expression left, @NonNull Expression right)
```

Creates an expression that checks if the first expression is less than or equal to the second expression.

```
// Check if the 'quantity' field is less than or equal to 20
lessThanOrEqual(field("quantity"), constant(20))
```

| Parameters |
|---|---|
| `@NonNull Expression left` | The first expression to compare. |
| `@NonNull Expression right` | The second expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the less than or equal to comparison. |

### like

```
public final @NonNull BooleanExpression like(@NonNull Expression pattern)
```

Creates an expression that performs a case-sensitive wildcard string comparison.

```
// Check if the 'title' field contains the string "guide"
field("title").like("%guide%")
```

| Parameters |
|---|---|
| `@NonNull Expression pattern` | The pattern to search for. You can use "%" as a wildcard character. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the like operation. |

### like

```
public final @NonNull BooleanExpression like(@NonNull String pattern)
```

Creates an expression that performs a case-sensitive wildcard string comparison.

```
// Check if the 'title' field contains the string "guide"
field("title").like("%guide%")
```

| Parameters |
|---|---|
| `@NonNull String pattern` | The pattern to search for. You can use "%" as a wildcard character. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the like operation. |

### like

```
public static final @NonNull BooleanExpression like(@NonNull String fieldName, @NonNull Expression pattern)
```

Creates an expression that performs a case-sensitive wildcard string comparison against a field.

```
// Check if the 'title' field contains the string "guide"
like("title", "%guide%")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string. |
| `@NonNull Expression pattern` | The pattern to search for. You can use "%" as a wildcard character. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the like comparison. |

### like

```
public static final @NonNull BooleanExpression like(@NonNull String fieldName, @NonNull String pattern)
```

Creates an expression that performs a case-sensitive wildcard string comparison against a field.

```
// Check if the 'title' field contains the string "guide"
like("title", "%guide%")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string. |
| `@NonNull String pattern` | The pattern to search for. You can use "%" as a wildcard character. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the like comparison. |

### like

```
public static final @NonNull BooleanExpression like(@NonNull Expression stringExpression, @NonNull Expression pattern)
```

Creates an expression that performs a case-sensitive wildcard string comparison.

```
// Check if the 'title' field contains the string "guide"
like(field("title"), "%guide%")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to perform the comparison on. |
| `@NonNull Expression pattern` | The pattern to search for. You can use "%" as a wildcard character. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the like operation. |

### like

```
public static final @NonNull BooleanExpression like(@NonNull Expression stringExpression, @NonNull String pattern)
```

Creates an expression that performs a case-sensitive wildcard string comparison.

```
// Check if the 'title' field contains the string "guide"
like(field("title"), "%guide%")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to perform the comparison on. |
| `@NonNull String pattern` | The pattern to search for. You can use "%" as a wildcard character. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the like operation. |

### ln

```
public final @NonNull Expression ln()
```

Creates an expression that returns the natural logarithm of this numeric expression.

```
// compute the natural logarithm of the 'value' field.
field("value").ln()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the natural logarithm operation. |

### ln

```
public static final @NonNull Expression ln(@NonNull Expression numericExpr)
```

Creates an expression that returns the natural logarithm (base e) of `numericExpr`.

```
// Compute the natural logarithm of the 'value' field.
ln(field("value"))
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the natural logarithm. |

### ln

```
public static final @NonNull Expression ln(@NonNull String numericField)
```

Creates an expression that returns the natural logarithm (base e) of `numericField`.

```
// Compute the natural logarithm of the 'value' field.
ln("value")
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the natural logarithm. |

### log

```
public static final @NonNull Expression log(@NonNull Expression numericExpr, @NonNull Expression base)
```

Creates an expression that returns the logarithm of `numericExpr` with a given `base`.

```
// Compute the logarithm of the 'value' field with the base in the 'base' field.
log(field("value"), field("base"))
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |
| `@NonNull Expression base` | The base of the logarithm. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing a numeric result from the logarithm of `numericExpr` with a given `base`. |

### log

```
public static final @NonNull Expression log(@NonNull Expression numericExpr, @NonNull Number base)
```

Creates an expression that returns the logarithm of `numericExpr` with a given `base`.

```
// Compute the logarithm of the 'value' field with base 10.
log(field("value"), 10)
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |
| `@NonNull Number base` | The base of the logarithm. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing a numeric result from the logarithm of `numericExpr` with a given `base`. |

### log

```
public static final @NonNull Expression log(@NonNull String numericField, @NonNull Expression base)
```

Creates an expression that returns the logarithm of `numericField` with a given `base`.

```
// Compute the logarithm of the 'value' field with the base in the 'base' field.
log("value", field("base"))
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |
| `@NonNull Expression base` | The base of the logarithm. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing a numeric result from the logarithm of `numericField` with a given `base`. |

### log

```
public static final @NonNull Expression log(@NonNull String numericField, @NonNull Number base)
```

Creates an expression that returns the logarithm of `numericField` with a given `base`.

```
// Compute the logarithm of the 'value' field with base 10.
log("value", 10)
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |
| `@NonNull Number base` | The base of the logarithm. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing a numeric result from the logarithm of `numericField` with a given `base`. |

### log10

```
public final @NonNull Expression log10()
```

Creates an expression that returns the base-10 logarithm of this numeric expression.

```
// compute the base-10 logarithm of the 'value' field.
field("value").log10()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the base-10 logarithm operation. |

### log10

```
public static final @NonNull Expression log10(@NonNull Expression numericExpr)
```

Creates an expression that returns the base 10 logarithm of `numericExpr`.

```
// Compute the base 10 logarithm of the 'value' field.
log10(field("value"))
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the base 10 logarithm. |

### log10

```
public static final @NonNull Expression log10(@NonNull String numericField)
```

Creates an expression that returns the base 10 logarithm of `numericField`.

```
// Compute the base 10 logarithm of the 'value' field.
log10("value")
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the base 10 logarithm. |

### logicalMaximum

```
public final @NonNull Expression logicalMaximum(@NonNull Object others)
```

Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering.

```
// Returns the larger value between the 'timestamp' field and the current timestamp.
field("timestamp").logicalMaximum(currentTimestamp())
```

| Parameters |
|---|---|
| `@NonNull Object others` | Expressions or literals. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the logical maximum operation. |

### logicalMaximum

```
public final @NonNull Expression logicalMaximum(@NonNull Expression others)
```

Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering.

```
// Returns the larger value between the 'timestamp' field and the current timestamp.
field("timestamp").logicalMaximum(currentTimestamp())
```

| Parameters |
|---|---|
| `@NonNull Expression others` | Expressions or literals. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the logical maximum operation. |

### logicalMaximum

```
public static final @NonNull Expression logicalMaximum(@NonNull Expression expr, @NonNull Object others)
```

Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering.

```
// Returns the larger value between the 'timestamp' field and the current timestamp.
logicalMaximum(field("timestamp"), currentTimestamp())
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The first operand expression. |
| `@NonNull Object others` | Optional additional expressions or literals. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the logical maximum operation. |

### logicalMaximum

```
public static final @NonNull Expression logicalMaximum(@NonNull String fieldName, @NonNull Object others)
```

Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering.

```
// Returns the larger value between the 'timestamp' field and the current timestamp.
logicalMaximum("timestamp", currentTimestamp())
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The first operand field name. |
| `@NonNull Object others` | Optional additional expressions or literals. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the logical maximum operation. |

### logicalMinimum

```
public final @NonNull Expression logicalMinimum(@NonNull Object others)
```

Creates an expression that returns the smallest value between multiple input expressions or literal values. Based on Firestore's value type ordering.

```
// Returns the smaller value between the 'timestamp' field and the current timestamp.
field("timestamp").logicalMinimum(currentTimestamp())
```

| Parameters |
|---|---|
| `@NonNull Object others` | Expressions or literals. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the logical minimum operation. |

### logicalMinimum

```
public final @NonNull Expression logicalMinimum(@NonNull Expression others)
```

Creates an expression that returns the smallest value between multiple input expressions or literal values. Based on Firestore's value type ordering.

```
// Returns the smaller value between the 'timestamp' field and the current timestamp.
field("timestamp").logicalMinimum(currentTimestamp())
```

| Parameters |
|---|---|
| `@NonNull Expression others` | Expressions or literals. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the logical minimum operation. |

### logicalMinimum

```
public static final @NonNull Expression logicalMinimum(@NonNull Expression expr, @NonNull Object others)
```

Creates an expression that returns the smallest value between multiple input expressions or literal values. Based on Firestore's value type ordering.

```
// Returns the smaller value between the 'timestamp' field and the current timestamp.
logicalMinimum(field("timestamp"), currentTimestamp())
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The first operand expression. |
| `@NonNull Object others` | Optional additional expressions or literals. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the logical minimum operation. |

### logicalMinimum

```
public static final @NonNull Expression logicalMinimum(@NonNull String fieldName, @NonNull Object others)
```

Creates an expression that returns the smallest value between multiple input expressions or literal values. Based on Firestore's value type ordering.

```
// Returns the smaller value between the 'timestamp' field and the current timestamp.
logicalMinimum("timestamp", currentTimestamp())
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The first operand field name. |
| `@NonNull Object others` | Optional additional expressions or literals. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the logical minimum operation. |

### ltrim

```
public final @NonNull Expression ltrim()
```

Creates an expression that removes leading whitespace from this string expression.

```
// Trim leading whitespace from the 'text' field.
field("text").ltrim()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ltrim operation. |

### ltrim

```
public static final @NonNull Expression ltrim(@NonNull String fieldName)
```

Creates an expression that removes leading whitespace from a string field.

```
// Trim leading whitespace from the 'text' field.
ltrim("text")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to trim. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ltrim operation. |

### ltrim

```
public static final @NonNull Expression ltrim(@NonNull Expression stringExpression)
```

Creates an expression that removes leading whitespace from a string expression.

```
// Trim leading whitespace from the 'text' field.
ltrim(field("text"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to trim. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ltrim operation. |

### ltrimValue

```
public final @NonNull Expression ltrimValue(@NonNull Expression valuesToTrim)
```

Creates an expression that removes a set of leading values from this string expression.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim leading characters defined by the 'chars' field from the 'text' field.
field("text").ltrimValue(field("chars"))
```

| Parameters |
|---|---|
| `@NonNull Expression valuesToTrim` | The expression representing the set of values to remove. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ltrim operation. |

### ltrimValue

```
public final @NonNull Expression ltrimValue(@NonNull String valuesToTrim)
```

Creates an expression that removes a set of leading values from this string expression.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim all leading '-' and '_' characters from the 'text' field.
field("text").ltrimValue("-_")
```

| Parameters |
|---|---|
| `@NonNull String valuesToTrim` | The string of characters to remove. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ltrim operation. |

### ltrimValue

```
public static final @NonNull Expression ltrimValue(@NonNull String fieldName, @NonNull Expression valuesToTrim)
```

Creates an expression that removes specified leading values from a string field.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim leading characters defined by the 'chars' field from the 'text' field.
ltrimValue("text", field("chars"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to trim. |
| `@NonNull Expression valuesToTrim` | The expression representing the set of values to remove. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ltrim operation. |

### ltrimValue

```
public static final @NonNull Expression ltrimValue(@NonNull String fieldName, @NonNull String valuesToTrim)
```

Creates an expression that removes specified leading values from a string field.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim all leading '-' and '_' characters from the 'text' field.
ltrimValue("text", "-_")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to trim. |
| `@NonNull String valuesToTrim` | The set of values to remove. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ltrim operation. |

### ltrimValue

```
public static final @NonNull Expression ltrimValue(
    @NonNull Expression stringExpression,
    @NonNull Expression valuesToTrim
)
```

Creates an expression that removes a set of leading values from a string expression.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim leading characters defined by the 'chars' field from the 'text' field.
ltrimValue(field("text"), field("chars"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to trim. |
| `@NonNull Expression valuesToTrim` | The expression representing the set of values to remove. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ltrim operation. |

### ltrimValue

```
public static final @NonNull Expression ltrimValue(
    @NonNull Expression stringExpression,
    @NonNull String valuesToTrim
)
```

Creates an expression that removes a set of leading values from a string expression.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim all leading '-' and '_' characters from the 'text' field.
ltrimValue(field("text"), "-_")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to trim. |
| `@NonNull String valuesToTrim` | The set of values to remove. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the ltrim operation. |

### map

```
public static final @NonNull Expression map(@NonNull Map<@NonNull String, @NonNull Object> elements)
```

Creates an expression that creates a Firestore map value from an input object.

```
// Create a map with a constant key and a field value
map(mapOf("name" to field("productName"), "quantity" to 1))
```

| Parameters |
|---|---|
| `@NonNull Map<@NonNull String, @NonNull Object> elements` | The input map to evaluate in the expression. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the map function. |

### mapEntries

```
public final @NonNull Expression mapEntries()
```

Creates an expression that returns the entries of this map expression as an array of maps, where each map contains a "k" property for the key and a "v" property for the value.

While the backend generally preserves insertion order, relying on the order of the output array is not guaranteed and should be avoided.

```
// Get the entries of the 'metadata' map field.
field("metadata").mapEntries()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the entries of the map. |

### mapEntries

```
public static final @NonNull Expression mapEntries(@NonNull Expression mapExpr)
```

Creates an expression that returns the entries of a map as an array of maps, where each map contains a "k" property for the key and a "v" property for the value.

Note: While the backend generally preserves insertion order, relying on the order of the output array is not guaranteed and should be avoided.

```
// Get the entries of a map expression.
mapEntries(map(mapOf("a" to 1, "b" to 2)))
```

| Parameters |
|---|---|
| `@NonNull Expression mapExpr` | The expression representing the map to get the entries of. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the entries of the map. |

### mapEntries

```
public static final @NonNull Expression mapEntries(@NonNull String mapField)
```

Creates an expression that returns the entries of a map as an array of maps.

Note: While the backend generally preserves insertion order, relying on the order of the output array is not guaranteed and should be avoided.

```
// Get the entries of the 'metadata' map field.
mapEntries("metadata")
```

| Parameters |
|---|---|
| `@NonNull String mapField` | The map field to get the entries of. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the entries of the map. |

### mapGet

```
public final @NonNull Expression mapGet(@NonNull String key)
```

Accesses a map (object) value using the provided `key`.

```
// Get the 'city' value from the 'address' map field
field("address").mapGet("city")
```

| Parameters |
|---|---|
| `@NonNull String key` | The key to access in the map. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the value associated with the given key in the map. |

### mapGet

```
public final @NonNull Expression mapGet(@NonNull Expression keyExpression)
```

Accesses a map (object) value using the provided `keyExpression`.

```
// Get the value from the 'address' map field, using the key from the 'keyField' field
field("address").mapGet(field("keyField"))
```

| Parameters |
|---|---|
| `@NonNull Expression keyExpression` | The name of the key to remove from this map expression. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the value associated with the given key in the map. |

### mapGet

```
public static final @NonNull Expression mapGet(@NonNull String fieldName, @NonNull String key)
```

Accesses a value from a map (object) field using the provided `key`.

```
// Get the 'city' value from the 'address' map field
mapGet("address", "city")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name of the map field. |
| `@NonNull String key` | The key to access in the map. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the value associated with the given key in the map. |

### mapGet

```
public static final @NonNull Expression mapGet(@NonNull String fieldName, @NonNull Expression keyExpression)
```

Accesses a value from a map (object) field using the provided `keyExpression`.

```
// Get the value from the 'address' map field, using the key from the 'keyField' field
mapGet("address", field("keyField"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name of the map field. |
| `@NonNull Expression keyExpression` | The key to access in the map. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the value associated with the given key in the map. |

### mapGet

```
public static final @NonNull Expression mapGet(@NonNull Expression mapExpression, @NonNull String key)
```

Accesses a value from a map (object) field using the provided `key`.

```
// Get the 'city' value from the 'address' map field
mapGet(field("address"), "city")
```

| Parameters |
|---|---|
| `@NonNull Expression mapExpression` | The expression representing the map. |
| `@NonNull String key` | The key to access in the map. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the value associated with the given key in the map. |

### mapGet

```
public static final @NonNull Expression mapGet(
    @NonNull Expression mapExpression,
    @NonNull Expression keyExpression
)
```

Accesses a value from a map (object) field using the provided `keyExpression`.

```
// Get the value from the 'address' map field, using the key from the 'keyField' field
mapGet(field("address"), field("keyField"))
```

| Parameters |
|---|---|
| `@NonNull Expression mapExpression` | The expression representing the map. |
| `@NonNull Expression keyExpression` | The key to access in the map. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the value associated with the given key in the map. |

### mapKeys

```
public final @NonNull Expression mapKeys()
```

Creates an expression that returns the keys of this map expression.

While the backend generally preserves insertion order, relying on the order of the output array is not guaranteed and should be avoided.

```
// Get the keys of the 'metadata' map field.
field("metadata").mapKeys()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the keys of the map. |

### mapKeys

```
public static final @NonNull Expression mapKeys(@NonNull Expression mapExpr)
```

Creates an expression that returns the keys of a map.

Note: While the backend generally preserves insertion order, relying on the order of the output array is not guaranteed and should be avoided.

```
// Get the keys of a map expression.
mapKeys(map(mapOf("a" to 1, "b" to 2)))
```

| Parameters |
|---|---|
| `@NonNull Expression mapExpr` | The expression representing the map to get the keys of. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the keys of the map. |

### mapKeys

```
public static final @NonNull Expression mapKeys(@NonNull String mapField)
```

Creates an expression that returns the keys of a map.

Note: While the backend generally preserves insertion order, relying on the order of the output array is not guaranteed and should be avoided.

```
// Get the keys of the 'metadata' map field.
mapKeys("metadata")
```

| Parameters |
|---|---|
| `@NonNull String mapField` | The map field to get the keys of. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the keys of the map. |

### mapMerge

```
public final @NonNull Expression mapMerge(@NonNull Expression mapExpr, @NonNull 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.

```
// Merges the map in the settings field with, a map literal, and a map in
// that is conditionally returned by another expression
field("settings").mapMerge(
  map(mapOf("enabled" to true)),
  conditional(
    field("isAdmin").equal(true),
    map(mapOf("admin" to true)),
    map(emptyMap<String, Any>())
  )
)
```

| Parameters |
|---|---|
| `@NonNull Expression mapExpr` | Map expression that will be merged. |
| `@NonNull Expression otherMaps` | Additional maps to merge. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the mapMerge operation. |

### mapMerge

```
public static final @NonNull Expression mapMerge(
    @NonNull Expression firstMap,
    @NonNull Expression secondMap,
    @NonNull 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.

```
// Merges the map in the settings field with, a map literal, and a map in
// that is conditionally returned by another expression
mapMerge(
  field("settings"),
  map(mapOf("enabled" to true)),
  conditional(
    field("isAdmin").equal(true),
    map(mapOf("admin" to true)),
    map(emptyMap<String, Any>())
  )
)
```

| Parameters |
|---|---|
| `@NonNull Expression firstMap` | First map expression that will be merged. |
| `@NonNull Expression secondMap` | Second map expression that will be merged. |
| `@NonNull Expression otherMaps` | Additional maps to merge. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the mapMerge operation. |

### mapMerge

```
public static final @NonNull Expression mapMerge(
    @NonNull String firstMapFieldName,
    @NonNull Expression secondMap,
    @NonNull 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.

```
// Merges the map in the settings field with, a map literal, and a map in
// that is conditionally returned by another expression
mapMerge(
  "settings",
  map(mapOf("enabled" to true)),
  conditional(
    field("isAdmin").equal(true),
    map(mapOf("admin" to true)),
    map(emptyMap<String, Any>())
  )
)
```

| Parameters |
|---|---|
| `@NonNull String firstMapFieldName` | First map field name that will be merged. |
| `@NonNull Expression secondMap` | Second map expression that will be merged. |
| `@NonNull Expression otherMaps` | Additional maps to merge. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the mapMerge operation. |

### mapRemove

```
public final @NonNull Expression mapRemove(@NonNull String key)
```

Creates an expression that removes a key from this map expression.

```
// Removes the key 'baz' from the input map.
map(mapOf("foo" to "bar", "baz" to true)).mapRemove("baz")
```

| Parameters |
|---|---|
| `@NonNull String key` | The name of the key to remove from this map expression. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to a modified map. |

### mapRemove

```
public final @NonNull Expression mapRemove(@NonNull Expression keyExpression)
```

Creates an expression that removes a key from this map expression.

```
// Removes the key 'baz' from the input map.
map(mapOf("foo" to "bar", "baz" to true)).mapRemove(constant("baz"))
```

| Parameters |
|---|---|
| `@NonNull Expression keyExpression` | The name of the key to remove from this map expression. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to a modified map. |

### mapRemove

```
public static final @NonNull Expression mapRemove(@NonNull Expression mapExpr, @NonNull Expression key)
```

Creates an expression that removes a key from the map produced by evaluating an expression.

```
// Removes the key 'baz' from the input map.
mapRemove(map(mapOf("foo" to "bar", "baz" to true)), constant("baz"))
```

| Parameters |
|---|---|
| `@NonNull Expression mapExpr` | An expression that evaluates to a map. |
| `@NonNull Expression key` | The name of the key to remove from the input map. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to a modified map. |

### mapRemove

```
public static final @NonNull Expression mapRemove(@NonNull Expression mapExpr, @NonNull String key)
```

Creates an expression that removes a key from the map produced by evaluating an expression.

```
// Removes the key 'baz' from the input map.
mapRemove(map(mapOf("foo" to "bar", "baz" to true)), "baz")
```

| Parameters |
|---|---|
| `@NonNull Expression mapExpr` | An expression that evaluates to a map. |
| `@NonNull String key` | The name of the key to remove from the input map. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to a modified map. |

### mapRemove

```
public static final @NonNull Expression mapRemove(@NonNull String mapField, @NonNull Expression key)
```

Creates an expression that removes a key from the map produced by evaluating an expression.

```
// Removes the key 'city' field from the map in the address field of the input document.
mapRemove("address", constant("city"))
```

| Parameters |
|---|---|
| `@NonNull String mapField` | The name of a field containing a map value. |
| `@NonNull Expression key` | The name of the key to remove from the input map. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to a modified map. |

### mapRemove

```
public static final @NonNull Expression mapRemove(@NonNull String mapField, @NonNull String key)
```

Creates an expression that removes a key from the map produced by evaluating an expression.

```
// Removes the key 'city' field from the map in the address field of the input document.
mapRemove("address", "city")
```

| Parameters |
|---|---|
| `@NonNull String mapField` | The name of a field containing a map value. |
| `@NonNull String key` | The name of the key to remove from the input map. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to a modified map. |

### mapSet

```
public final @NonNull Expression mapSet(
    @NonNull Expression key,
    @NonNull Expression value,
    @NonNull Expression moreKeyValues
)
```

Creates an expression that returns a new map with the specified entries added or updated.

- Only performs shallow updates to the map.

- Setting a value to `null` will retain the key with a `null` value. To remove a key entirely, use `mapRemove`.

```
// Set the 'category' key to the value of the 'newCategory' field.
field("metadata").mapSet(field("keyField"), field("newCategory"))
```

| Parameters |
|---|---|
| `@NonNull Expression key` | The key to set. |
| `@NonNull Expression value` | The value to set. |
| `@NonNull Expression moreKeyValues` | Additional key-value pairs to set. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the map with the entries set. |

### mapSet

```
public final @NonNull Expression mapSet(@NonNull String key, Object value, @NonNull Object moreKeyValues)
```

Creates an expression that returns a new map with the specified entries added or updated.

```
// Set the 'category' key to "Electronics" and 'active' to true.
field("metadata").mapSet("category", "Electronics", "active", true)
```

| Parameters |
|---|---|
| `@NonNull String key` | The key to set. |
| `Object value` | The value to set. |
| `@NonNull Object moreKeyValues` | Additional key-value pairs to set. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the map with the entries set. |

### mapSet

```
public static final @NonNull Expression mapSet(
    @NonNull Expression mapExpr,
    @NonNull Expression key,
    @NonNull Expression value,
    @NonNull Expression moreKeyValues
)
```

Creates an expression that returns a new map with the specified entries added or updated.

Note: This only performs shallow updates to the map. Setting a value to `null` will retain the key with a `null` value. To remove a key entirely, use `mapRemove`.

```
// Set the 'city' to "San Francisco" in the 'address' map
mapSet(field("address"), constant("city"), constant("San Francisco"));
```

| Parameters |
|---|---|
| `@NonNull Expression mapExpr` | The expression representing the map. |
| `@NonNull Expression key` | The key to set. Must be an expression representing a string. |
| `@NonNull Expression value` | The value to set. |
| `@NonNull Expression moreKeyValues` | Additional key-value pairs to set. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the map with the entries set. |

### mapSet

```
public static final @NonNull Expression mapSet(
    @NonNull Expression mapExpr,
    @NonNull String key,
    Object value,
    @NonNull Object moreKeyValues
)
```

Creates an expression that returns a new map with the specified entries added or updated.

Note: This only performs shallow updates to the map. Setting a value to `null` will retain the key with a `null` value. To remove a key entirely, use `mapRemove`.

```
// Set the 'city' to "San Francisco" in the 'address' map
mapSet(field("address"), "city", "San Francisco");
```

| Parameters |
|---|---|
| `@NonNull Expression mapExpr` | The map field to set entries in. |
| `@NonNull String key` | The key to set. |
| `Object value` | The value to set. |
| `@NonNull Object moreKeyValues` | Additional key-value pairs to set. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the map with the entries set. |

### mapSet

```
public static final @NonNull Expression mapSet(
    @NonNull String mapField,
    @NonNull Expression key,
    @NonNull Expression value,
    @NonNull Expression moreKeyValues
)
```

Creates an expression that returns a new map with the specified entries added or updated.

Note: This only performs shallow updates to the map. Setting a value to `null` will retain the key with a `null` value. To remove a key entirely, use `mapRemove`.

```
// Set the 'city' to "San Francisco" in the 'address' map
mapSet("address", constant("city"), constant("San Francisco"))
```

| Parameters |
|---|---|
| `@NonNull String mapField` | The map field to set entries in. |
| `@NonNull Expression key` | The key to set. Must be an expression representing a string. |
| `@NonNull Expression value` | The value to set. |
| `@NonNull Expression moreKeyValues` | Additional key-value pairs to set. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the map with the entries set. |

### mapSet

```
public static final @NonNull Expression mapSet(
    @NonNull String mapField,
    @NonNull String key,
    Object value,
    @NonNull Object moreKeyValues
)
```

Creates an expression that returns a new map with the specified entries added or updated.

Note: This only performs shallow updates to the map. Setting a value to `null` will retain the key with a `null` value. To remove a key entirely, use `mapRemove`.

```
// Set the 'city' to "San Francisco" in the 'address' map
mapSet("address", "city", "San Francisco")
```

| Parameters |
|---|---|
| `@NonNull String mapField` | The map field to set entries in. |
| `@NonNull String key` | The key to set. Must be an expression representing a string. |
| `Object value` | The value to set. |
| `@NonNull Object moreKeyValues` | Additional key-value pairs to set. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the map with the entries set. |

### mapValues

```
public final @NonNull Expression mapValues()
```

Creates an expression that returns the values of this map expression.

While the backend generally preserves insertion order, relying on the order of the output array is not guaranteed and should be avoided.

```
// Get the values of the 'metadata' map field.
field("metadata").mapValues()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the values of the map. |

### mapValues

```
public static final @NonNull Expression mapValues(@NonNull Expression mapExpr)
```

Creates an expression that returns the values of a map.

Note: While the backend generally preserves insertion order, relying on the order of the output array is not guaranteed and should be avoided.

```
// Get the values of a map expression.
mapValues(map(mapOf("a" to 1, "b" to 2)))
```

| Parameters |
|---|---|
| `@NonNull Expression mapExpr` | The expression representing the map to get the values of. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the values of the map. |

### mapValues

```
public static final @NonNull Expression mapValues(@NonNull String mapField)
```

Creates an expression that returns the values of a map.

Note: While the backend generally preserves insertion order, relying on the order of the output array is not guaranteed and should be avoided.

```
// Get the values of the 'metadata' map field.
mapValues("metadata")
```

| Parameters |
|---|---|
| `@NonNull String mapField` | The map field to get the values of. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the values of the map. |

### maximum

```
public final @NonNull AggregateFunction maximum()
```

Creates an aggregation that finds the maximum value of this expression across multiple stage inputs.

| Returns |
|---|---|
| `@NonNull AggregateFunction` | A new `AggregateFunction` representing the maximum aggregation. |

### minimum

```
public final @NonNull AggregateFunction minimum()
```

Creates an aggregation that finds the minimum value of this expression across multiple stage inputs.

| Returns |
|---|---|
| `@NonNull AggregateFunction` | A new `AggregateFunction` representing the minimum aggregation. |

### mod

```
public final @NonNull Expression mod(@NonNull Expression divisor)
```

Creates an expression that calculates the modulo (remainder) of dividing this numeric expressions by another numeric expression.

```
// Calculate the remainder of dividing the 'value' field by the 'divisor' field
field("value").mod(field("divisor"))
```

| Parameters |
|---|---|
| `@NonNull Expression divisor` | The numeric expression to divide this expression by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the modulo operation. |

### mod

```
public final @NonNull Expression mod(@NonNull Number divisor)
```

Creates an expression that calculates the modulo (remainder) of dividing this numeric expressions by a constant.

```
// Calculate the remainder of dividing the 'value' field by 3.
field("value").mod(3)
```

| Parameters |
|---|---|
| `@NonNull Number divisor` | The constant to divide this expression by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the modulo operation. |

### mod

```
public static final @NonNull Expression mod(@NonNull Expression dividend, @NonNull Expression divisor)
```

Creates an expression that calculates the modulo (remainder) of dividing two numeric expressions.

```
// Calculate the remainder of dividing the 'value' field by the 'divisor' field
mod(field("value"), field("divisor"))
```

| Parameters |
|---|---|
| `@NonNull Expression dividend` | The numeric expression to be divided. |
| `@NonNull Expression divisor` | The numeric expression to divide by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the modulo operation. |

### mod

```
public static final @NonNull Expression mod(@NonNull Expression dividend, @NonNull Number divisor)
```

Creates an expression that calculates the modulo (remainder) of dividing a numeric expression by a constant.

```
// Calculate the remainder of dividing the 'value' field by 3.
mod(field("value"), 3)
```

| Parameters |
|---|---|
| `@NonNull Expression dividend` | The numeric expression to be divided. |
| `@NonNull Number divisor` | The constant to divide by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the modulo operation. |

### mod

```
public static final @NonNull Expression mod(@NonNull String dividendFieldName, @NonNull Expression divisor)
```

Creates an expression that calculates the modulo (remainder) of dividing a numeric field by a constant.

```
// Calculate the remainder of dividing the 'value' field by the 'divisor' field.
mod("value", field("divisor"))
```

| Parameters |
|---|---|
| `@NonNull String dividendFieldName` | The numeric field name to be divided. |
| `@NonNull Expression divisor` | The numeric expression to divide by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the modulo operation. |

### mod

```
public static final @NonNull Expression mod(@NonNull String dividendFieldName, @NonNull Number divisor)
```

Creates an expression that calculates the modulo (remainder) of dividing a numeric field by a constant.

```
// Calculate the remainder of dividing the 'value' field by 3.
mod("value", 3)
```

| Parameters |
|---|---|
| `@NonNull String dividendFieldName` | The numeric field name to be divided. |
| `@NonNull Number divisor` | The constant to divide by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the modulo operation. |

### multiply

```
public final @NonNull Expression multiply(@NonNull Expression second)
```

Creates an expression that multiplies this numeric expression with another numeric expression.

```
// Multiply the 'quantity' field by the 'price' field
field("quantity").multiply(field("price"))
```

| Parameters |
|---|---|
| `@NonNull Expression second` | Numeric expression to multiply. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the multiplication operation. |

### multiply

```
public final @NonNull Expression multiply(@NonNull Number second)
```

Creates an expression that multiplies this numeric expression with a constant.

```
// Multiply the 'quantity' field by 1.1.
field("quantity").multiply(1.1)
```

| Parameters |
|---|---|
| `@NonNull Number second` | Constant to multiply. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the multiplication operation. |

### multiply

```
public static final @NonNull Expression multiply(@NonNull Expression first, @NonNull Expression second)
```

Creates an expression that multiplies numeric expressions.

```
// Multiply the 'quantity' field by the 'price' field
multiply(field("quantity"), field("price"))
```

| Parameters |
|---|---|
| `@NonNull Expression first` | Numeric expression to multiply. |
| `@NonNull Expression second` | Numeric expression to multiply. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the multiplication operation. |

### multiply

```
public static final @NonNull Expression multiply(@NonNull Expression first, @NonNull Number second)
```

Creates an expression that multiplies numeric expressions with a constant.

```
// Multiply the 'quantity' field by 1.1.
multiply(field("quantity"), 1.1)
```

| Parameters |
|---|---|
| `@NonNull Expression first` | Numeric expression to multiply. |
| `@NonNull Number second` | Constant to multiply. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the multiplication operation. |

### multiply

```
public static final @NonNull Expression multiply(@NonNull String numericFieldName, @NonNull Expression second)
```

Creates an expression that multiplies a numeric field with a numeric expression.

```
// Multiply the 'quantity' field by the 'price' field.
multiply("quantity", field("price"))
```

| Parameters |
|---|---|
| `@NonNull String numericFieldName` | Numeric field to multiply. |
| `@NonNull Expression second` | Numeric expression to multiply. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the multiplication operation. |

### multiply

```
public static final @NonNull Expression multiply(@NonNull String numericFieldName, @NonNull Number second)
```

Creates an expression that multiplies a numeric field with a constant.

```
// Multiply the 'quantity' field by 1.1.
multiply("quantity", 1.1)
```

| Parameters |
|---|---|
| `@NonNull String numericFieldName` | Numeric field to multiply. |
| `@NonNull Number second` | Constant to multiply. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the multiplication operation. |

### nor

```
public static final @NonNull BooleanExpression nor(
    @NonNull BooleanExpression condition,
    @NonNull BooleanExpression conditions
)
```

Creates an expression that performs a logical 'NOR' operation.

```
// Check if 'status' is neither "new" nor "open"
nor(field("status").equal("new"), field("status").equal("open"))
```

| Parameters |
|---|---|
| `@NonNull BooleanExpression condition` | The first `BooleanExpression`. |
| `@NonNull BooleanExpression conditions` | Additional `BooleanExpression`s. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the logical 'NOR' operation. |

### not

```
public static final @NonNull BooleanExpression not(@NonNull BooleanExpression condition)
```

Creates an expression that negates a boolean expression.

```
// Check if 'is_admin' is not true
not(field("is_admin"))
```

| Parameters |
|---|---|
| `@NonNull BooleanExpression condition` | The boolean expression to negate. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the not operation. |

### notEqual

```
public final @NonNull BooleanExpression notEqual(@NonNull Expression other)
```

Creates an expression that checks if this expressions is not equal to the `other` expression.

```
// Check if the 'status' field is not equal to the value of the 'otherStatus' field
field("status").notEqual(field("otherStatus"))
```

| Parameters |
|---|---|
| `@NonNull Expression other` | The expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the inequality comparison. |

### notEqual

```
public final @NonNull BooleanExpression notEqual(@NonNull Object value)
```

Creates an expression that checks if this expression is not equal to a `value`.

```
// Check if the 'status' field is not equal to "completed"
field("status").notEqual("completed")
```

| Parameters |
|---|---|
| `@NonNull Object value` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the inequality comparison. |

### notEqual

```
public static final @NonNull BooleanExpression notEqual(@NonNull String fieldName, @NonNull Expression expression)
```

Creates an expression that checks if a field's value is not equal to an expression.

```
// Check if the 'status' field is not equal to the value of the 'otherStatus' field
notEqual("status", field("otherStatus"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to compare. |
| `@NonNull Expression expression` | The expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the inequality comparison. |

### notEqual

```
public static final @NonNull BooleanExpression notEqual(@NonNull String fieldName, @NonNull Object value)
```

Creates an expression that checks if a field's value is not equal to another value.

```
// Check if the 'status' field is not equal to "completed"
notEqual("status", "completed")

// Check if the 'country' field is not equal to "USA"
notEqual("country", "USA")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name to compare. |
| `@NonNull Object value` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the inequality comparison. |

### notEqual

```
public static final @NonNull BooleanExpression notEqual(@NonNull Expression left, @NonNull Object right)
```

Creates an expression that checks if an expression is not equal to a value.

```
// Check if the 'status' field is not equal to "completed"
notEqual(field("status"), "completed")
```

| Parameters |
|---|---|
| `@NonNull Expression left` | The first expression to compare. |
| `@NonNull Object right` | The value to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the inequality comparison. |

### notEqual

```
public static final @NonNull BooleanExpression notEqual(@NonNull Expression left, @NonNull Expression right)
```

Creates an expression that checks if two expressions are not equal.

```
// Check if the 'status' field is not equal to the value of the 'otherStatus' field
notEqual(field("status"), field("otherStatus"))
```

| Parameters |
|---|---|
| `@NonNull Expression left` | The first expression to compare. |
| `@NonNull Expression right` | The second expression to compare to. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the inequality comparison. |

### notEqualAny

```
public final @NonNull BooleanExpression notEqualAny(@NonNull Expression arrayExpression)
```

Creates an expression that checks if this expression, when evaluated, is not equal to all the elements of `arrayExpression`.

```
// Check if the 'status' field is not in the 'inactiveStatuses' array field.
field("status").notEqualAny(field("inactiveStatuses"))
```

| Parameters |
|---|---|
| `@NonNull Expression arrayExpression` | An expression that evaluates to an array, whose elements to check for equality to the input. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'NOT IN' comparison. |

### notEqualAny

```
public final @NonNull BooleanExpression notEqualAny(@NonNull List<@NonNull Object> values)
```

Creates an expression that checks if this expression, when evaluated, is not equal to all the provided `values`.

```
// Check if the 'status' field is neither "pending" nor the value of the 'rejectedStatus' field.
field("status").notEqualAny(listOf("pending", field("rejectedStatus")))
```

| Parameters |
|---|---|
| `@NonNull List<@NonNull Object> values` | The values to check against. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'NOT IN' comparison. |

### notEqualAny

```
public static final @NonNull BooleanExpression notEqualAny(
    @NonNull Expression expression,
    @NonNull Expression arrayExpression
)
```

Creates an expression that checks if an `expression`, when evaluated, is not equal to all the elements of `arrayExpression`.

```
// Check if the 'status' field is not in the 'inactiveStatuses' array field.
notEqualAny(field("status"), field("inactiveStatuses"))
```

| Parameters |
|---|---|
| `@NonNull Expression expression` | The expression whose results to compare. |
| `@NonNull Expression arrayExpression` | An expression that evaluates to an array, whose elements to check for equality to the input. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'NOT IN' comparison. |

### notEqualAny

```
public static final @NonNull BooleanExpression notEqualAny(
    @NonNull Expression expression,
    @NonNull List<@NonNull Object> values
)
```

Creates an expression that checks if an `expression`, when evaluated, is not equal to all the provided `values`.

```
// Check if the 'status' field is neither "pending" nor the value of the 'rejectedStatus' field.
notEqualAny(field("status"), listOf("pending", field("rejectedStatus")))
```

| Parameters |
|---|---|
| `@NonNull Expression expression` | The expression whose results to compare. |
| `@NonNull List<@NonNull Object> values` | The values to check against. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'NOT IN' comparison. |

### notEqualAny

```
public static final @NonNull BooleanExpression notEqualAny(@NonNull String fieldName, @NonNull Expression arrayExpression)
```

Creates an expression that checks if a field's value is not equal to all of the elements of `arrayExpression`.

```
// Check if the 'status' field is not in the 'inactiveStatuses' array field.
notEqualAny("status", field("inactiveStatuses"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field to compare. |
| `@NonNull Expression arrayExpression` | An expression that evaluates to an array, whose elements to check for equality to the input. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'NOT IN' comparison. |

### notEqualAny

```
public static final @NonNull BooleanExpression notEqualAny(@NonNull String fieldName, @NonNull List<@NonNull Object> values)
```

Creates an expression that checks if a field's value is not equal to all of the provided `values`.

```
// Check if the 'status' field is not "archived" or "deleted".
notEqualAny("status", listOf("archived", "deleted"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field to compare. |
| `@NonNull List<@NonNull Object> values` | The values to check against. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'NOT IN' comparison. |

### nullValue

```
public static final @NonNull Expression nullValue()
```

Constant for a null value.

```
// Create a null constant
nullValue()
```

| Returns |
|---|---|
| `@NonNull Expression` | A `Expression` constant instance. |

### or

```
public static final @NonNull BooleanExpression or(
    @NonNull BooleanExpression condition,
    @NonNull BooleanExpression conditions
)
```

Creates an expression that performs a logical 'OR' operation.

```
// Check if 'status' is "new" or "open"
or(field("status").equal("new"), field("status").equal("open"))
```

| Parameters |
|---|---|
| `@NonNull BooleanExpression condition` | The first `BooleanExpression`. |
| `@NonNull BooleanExpression conditions` | Additional `BooleanExpression`s. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the logical 'OR' operation. |

### parent

```
public final @NonNull Expression parent()
```

Creates an expression that returns the parent document reference of this document reference expression.

```
// Get the parent document reference of the 'path' field.
field("path").parent()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the parent operation. |

### parent

```
public static final @NonNull Expression parent(@NonNull DocumentReference docRef)
```

Creates an expression that returns the parent document reference of a document reference.

```
// Get the parent document reference of a document reference.
parent(myDocumentReference)
```

| Parameters |
|---|---|
| `@NonNull DocumentReference docRef` | A `DocumentReference` to get the parent from. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the parent operation. |

### parent

```
public static final @NonNull Expression parent(@NonNull Expression documentPath)
```

Creates an expression that returns the parent document reference of a document reference.

```
// Get the parent document reference of a document reference.
parent(field("__path__"))
```

| Parameters |
|---|---|
| `@NonNull Expression documentPath` | An expression evaluating to a document reference. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the parent operation. |

### parent

```
public static final @NonNull Expression parent(@NonNull String documentPath)
```

Creates an expression that returns the parent document reference of a document reference.

```
// Get the parent document reference of a document reference.
parent("projects/p/databases/d/documents/c/d")
```

| Parameters |
|---|---|
| `@NonNull String documentPath` | A string path to get the parent from. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the parent operation. |

### pow

```
public final @NonNull Expression pow(@NonNull 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.

```
// Raise the value of the 'base' field to the power of the 'exponent' field.
field("base").pow(field("exponent"))
```

| Parameters |
|---|---|
| `@NonNull Expression exponent` | The numeric power to raise this numeric expression. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing a numeric result from raising this numeric expression to the power of `exponent`. |

### pow

```
public final @NonNull Expression pow(@NonNull 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.

```
// Raise the value of the 'base' field to the power of 2.
field("base").pow(2)
```

| Parameters |
|---|---|
| `@NonNull Number exponent` | The numeric power to raise this numeric expression. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing a numeric result from raising this numeric expression to the power of `exponent`. |

### pow

```
public static final @NonNull Expression pow(@NonNull Expression numericExpr, @NonNull Expression exponent)
```

Creates an expression that returns the `numericExpr` raised to the power of the `exponent`. Returns infinity on overflow and zero on underflow.

```
// Raise the value of the 'base' field to the power of the 'exponent' field.
pow(field("base"), field("exponent"))
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |
| `@NonNull Expression exponent` | The numeric power to raise the `numericExpr`. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing a numeric result from raising `numericExpr` to the power of `exponent`. |

### pow

```
public static final @NonNull Expression pow(@NonNull Expression numericExpr, @NonNull Number exponent)
```

Creates an expression that returns the `numericExpr` raised to the power of the `exponent`. Returns infinity on overflow and zero on underflow.

```
// Raise the value of the 'base' field to the power of 2.
pow(field("base"), 2)
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |
| `@NonNull Number exponent` | The numeric power to raise the `numericExpr`. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing a numeric result from raising `numericExpr` to the power of `exponent`. |

### pow

```
public static final @NonNull Expression pow(@NonNull String numericField, @NonNull Expression exponent)
```

Creates an expression that returns the `numericField` raised to the power of the `exponent`. Returns infinity on overflow and zero on underflow.

```
// Raise the value of the 'base' field to the power of the 'exponent' field.
pow("base", field("exponent"))
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |
| `@NonNull Expression exponent` | The numeric power to raise the `numericField`. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing a numeric result from raising `numericField` to the power of `exponent`. |

### pow

```
public static final @NonNull Expression pow(@NonNull String numericField, @NonNull Number exponent)
```

Creates an expression that returns the `numericField` raised to the power of the `exponent`. Returns infinity on overflow and zero on underflow.

```
// Raise the value of the 'base' field to the power of 2.
pow("base", 2)
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |
| `@NonNull Number exponent` | The numeric power to raise the `numericField`. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing a numeric result from raising `numericField` to the power of `exponent`. |

### rand

```
public static final @NonNull Expression rand()
```

Creates an expression that returns a pseudo-random number of type double in the range of \[0, 1), inclusive of 0 and exclusive of 1.

```
// Get a random number.
rand()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the random number operation. |

### rawFunction

```
public static final @NonNull Expression rawFunction(@NonNull String name, @NonNull Expression expr)
```

Creates a 'raw' function expression. This is useful if the expression is available in the backend, but not yet in the current version of the SDK yet.

```
// Create a generic function call
rawFunction("my_function", field("arg1"), constant(42))
```

| Parameters |
|---|---|
| `@NonNull String name` | The name of the raw function. |
| `@NonNull Expression expr` | The expressions to be passed as arguments to the function. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the raw function. |

### regexContains

```
public final @NonNull BooleanExpression regexContains(@NonNull Expression pattern)
```

Creates an expression that checks if this string expression contains a specified regular expression as a substring.

```
// Check if the 'description' field contains "example" (case-insensitive)
field("description").regexContains("(?i)example")
```

| Parameters |
|---|---|
| `@NonNull Expression pattern` | The regular expression to use for the search. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the contains regular expression comparison. |

### regexContains

```
public final @NonNull BooleanExpression regexContains(@NonNull String pattern)
```

Creates an expression that checks if this string expression contains a specified regular expression as a substring.

```
// Check if the 'description' field contains "example" (case-insensitive)
field("description").regexContains("(?i)example")
```

| Parameters |
|---|---|
| `@NonNull String pattern` | The regular expression to use for the search. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the contains regular expression comparison. |

### regexContains

```
public static final @NonNull BooleanExpression regexContains(@NonNull String fieldName, @NonNull Expression pattern)
```

Creates an expression that checks if a string field contains a specified regular expression as a substring.

```
// Check if the 'description' field contains the regex from the 'pattern' field.
regexContains("description", field("pattern"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string. |
| `@NonNull Expression pattern` | The regular expression to use for the search. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the contains regular expression comparison. |

### regexContains

```
public static final @NonNull BooleanExpression regexContains(@NonNull String fieldName, @NonNull String pattern)
```

Creates an expression that checks if a string field contains a specified regular expression as a substring.

```
// Check if the 'description' field contains "example" (case-insensitive)
regexContains("description", "(?i)example")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string. |
| `@NonNull String pattern` | The regular expression to use for the search. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the contains regular expression comparison. |

### regexContains

```
public static final @NonNull BooleanExpression regexContains(
    @NonNull Expression stringExpression,
    @NonNull Expression pattern
)
```

Creates an expression that checks if a string expression contains a specified regular expression as a substring.

```
// Check if the 'description' field contains "example" (case-insensitive)
regexContains(field("description"), "(?i)example")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to perform the comparison on. |
| `@NonNull Expression pattern` | The regular expression to use for the search. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the contains regular expression comparison. |

### regexContains

```
public static final @NonNull BooleanExpression regexContains(
    @NonNull Expression stringExpression,
    @NonNull String pattern
)
```

Creates an expression that checks if a string expression contains a specified regular expression as a substring.

```
// Check if the 'description' field contains "example" (case-insensitive)
regexContains(field("description"), "(?i)example")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to perform the comparison on. |
| `@NonNull String pattern` | The regular expression to use for the search. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the contains regular expression comparison. |

### regexFind

```
public static final @NonNull Expression regexFind(@NonNull String fieldName, @NonNull Expression pattern)
```

Creates an expression that returns the first substring of a string field that matches a specified regular expression.

This expression uses the [RE2](https://github.com/google/re2/wiki/Syntax) regular expression syntax.

```
// Extract a substring from 'email' based on a pattern stored in another field
regexFind("email", field("pattern"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to search. |
| `@NonNull Expression pattern` | The regular expression to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the regular expression find function. |

### regexFind

```
public static final @NonNull Expression regexFind(@NonNull String fieldName, @NonNull String pattern)
```

Creates an expression that returns the first substring of a string field that matches a specified regular expression.

This expression uses the [RE2](https://github.com/google/re2/wiki/Syntax) regular expression syntax.

```
// Extract the domain name from an email field
regexFind("email", "@[A-Za-z0-9.-]+")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to search. |
| `@NonNull String pattern` | The regular expression to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the regular expression find function. |

### regexFind

```
public static final @NonNull Expression regexFind(
    @NonNull Expression stringExpression,
    @NonNull Expression pattern
)
```

Creates an expression that returns the first substring of a string expression that matches a specified regular expression.

This expression uses the [RE2](https://github.com/google/re2/wiki/Syntax) regular expression syntax.

```
// Extract a substring based on a dynamic pattern field
regexFind(field("email"), field("pattern"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to search. |
| `@NonNull Expression pattern` | The regular expression to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the regular expression find function. |

### regexFind

```
public static final @NonNull Expression regexFind(@NonNull Expression stringExpression, @NonNull String pattern)
```

Creates an expression that returns the first substring of a string expression that matches a specified regular expression.

This expression uses the [RE2](https://github.com/google/re2/wiki/Syntax) regular expression syntax.

```
// Extract the domain from a lower-cased email address
regexFind(field("email"), "@[A-Za-z0-9.-]+")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to search. |
| `@NonNull String pattern` | The regular expression to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the regular expression find function. |

### regexFindAll

```
public static final @NonNull Expression regexFindAll(@NonNull String fieldName, @NonNull Expression pattern)
```

Creates an expression that evaluates to a list of all substrings in a string field that match a specified regular expression.

This expression uses the [RE2](https://github.com/google/re2/wiki/Syntax) regular expression syntax.

```
// Extract all matches from 'content' based on a pattern stored in another field
regexFindAll("content", field("pattern"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to search. |
| `@NonNull Expression pattern` | The regular expression to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to a list of matched substrings. |

### regexFindAll

```
public static final @NonNull Expression regexFindAll(@NonNull String fieldName, @NonNull String pattern)
```

Creates an expression that evaluates to a list of all substrings in a string field that match a specified regular expression.

This expression uses the [RE2](https://github.com/google/re2/wiki/Syntax) regular expression syntax.

```
// Extract all hashtags from a post content field
regexFindAll("content", "#[A-Za-z0-9_]+")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to search. |
| `@NonNull String pattern` | The regular expression to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to a list of matched substrings. |

### regexFindAll

```
public static final @NonNull Expression regexFindAll(
    @NonNull Expression stringExpression,
    @NonNull Expression pattern
)
```

Creates an expression that evaluates to a list of all substrings in a string expression that match a specified regular expression.

This expression uses the [RE2](https://github.com/google/re2/wiki/Syntax) regular expression syntax.

```
// Extract all matches based on a dynamic pattern expression
regexFindAll(field("comment"), field("pattern"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to search. |
| `@NonNull Expression pattern` | The regular expression to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to a list of matched substrings. |

### regexFindAll

```
public static final @NonNull Expression regexFindAll(@NonNull Expression stringExpression, @NonNull String pattern)
```

Creates an expression that evaluates to a list of all substrings in a string expression that match a specified regular expression.

This expression uses the [RE2](https://github.com/google/re2/wiki/Syntax) regular expression syntax.

```
// Extract all mentions from a lower-cased comment
regexFindAll(field("comment"), "@[A-Za-z0-9_]+")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to search. |
| `@NonNull String pattern` | The regular expression to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to a list of matched substrings. |

### regexMatch

```
public final @NonNull BooleanExpression regexMatch(@NonNull Expression pattern)
```

Creates an expression that checks if this string expression matches a specified regular expression.

```
// Check if the 'email' field matches a valid email pattern
field("email").regexMatch("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}")
```

| Parameters |
|---|---|
| `@NonNull Expression pattern` | The regular expression to use for the match. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the regular expression match comparison. |

### regexMatch

```
public final @NonNull BooleanExpression regexMatch(@NonNull String pattern)
```

Creates an expression that checks if this string expression matches a specified regular expression.

```
// Check if the 'email' field matches a valid email pattern
field("email").regexMatch("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}")
```

| Parameters |
|---|---|
| `@NonNull String pattern` | The regular expression to use for the match. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the regular expression match comparison. |

### regexMatch

```
public static final @NonNull BooleanExpression regexMatch(@NonNull String fieldName, @NonNull Expression pattern)
```

Creates an expression that checks if a string field matches a specified regular expression.

```
// Check if the 'email' field matches the regex from the 'pattern' field.
regexMatch("email", field("pattern"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string. |
| `@NonNull Expression pattern` | The regular expression to use for the match. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the regular expression match comparison. |

### regexMatch

```
public static final @NonNull BooleanExpression regexMatch(@NonNull String fieldName, @NonNull String pattern)
```

Creates an expression that checks if a string field matches a specified regular expression.

```
// Check if the 'email' field matches a valid email pattern
regexMatch("email", "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string. |
| `@NonNull String pattern` | The regular expression to use for the match. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the regular expression match comparison. |

### regexMatch

```
public static final @NonNull BooleanExpression regexMatch(
    @NonNull Expression stringExpression,
    @NonNull Expression pattern
)
```

Creates an expression that checks if a string field matches a specified regular expression.

```
// Check if the 'email' field matches a valid email pattern
regexMatch(field("email"), "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to match against. |
| `@NonNull Expression pattern` | The regular expression to use for the match. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the regular expression match comparison. |

### regexMatch

```
public static final @NonNull BooleanExpression regexMatch(@NonNull Expression stringExpression, @NonNull String pattern)
```

Creates an expression that checks if a string field matches a specified regular expression.

```
// Check if the 'email' field matches a valid email pattern
regexMatch(field("email"), "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to match against. |
| `@NonNull String pattern` | The regular expression to use for the match. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the regular expression match comparison. |

### reverse

```
public final @NonNull Expression reverse()
```

Creates an expression that reverses this string expression.

```
// Reverse the value of the 'myString' field.
field("myString").reverse()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the reversed string. |

### reverse

```
public static final @NonNull Expression reverse(@NonNull String fieldName)
```

Creates an expression that reverses a string value from the specified field.

```
// Reverse the value of the 'myString' field.
reverse("myString")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field that contains the string to reverse. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the reversed string. |

### reverse

```
public static final @NonNull Expression reverse(@NonNull Expression stringExpression)
```

Creates an expression that reverses a string.

```
// Reverse the value of the 'myString' field.
reverse(field("myString"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | An expression evaluating to a string value, which will be reversed. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the reversed string. |

### round

```
public final @NonNull Expression round()
```

Creates an expression that rounds this numeric expression to nearest integer.

```
// Round the value of the 'price' field.
field("price").round()
```

Rounds away from zero in halfway cases.

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing an integer result from the round operation. |

### round

```
public static final @NonNull Expression round(@NonNull Expression numericExpr)
```

Creates an expression that rounds `numericExpr` to nearest integer.

```
// Round the value of the 'price' field.
round(field("price"))
```

Rounds away from zero in halfway cases.

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing an integer result from the round operation. |

### round

```
public static final @NonNull Expression round(@NonNull String numericField)
```

Creates an expression that rounds `numericField` to nearest integer.

```
// Round the value of the 'price' field.
round("price")
```

Rounds away from zero in halfway cases.

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing an integer result from the round operation. |

### roundToPrecision

```
public final @NonNull Expression roundToPrecision(@NonNull 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.

```
// Round the value of the 'price' field to the number of decimal places specified in the
// 'precision' field.
field("price").roundToPrecision(field("precision"))
```

| Parameters |
|---|---|
| `@NonNull Expression decimalPlace` | The number of decimal places to round. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the round operation. |

### roundToPrecision

```
public final @NonNull 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.

```
// Round the value of the 'price' field to 2 decimal places.
field("price").roundToPrecision(2)
```

| Parameters |
|---|---|
| `int decimalPlace` | The number of decimal places to round. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the round operation. |

### roundToPrecision

```
public static final @NonNull Expression roundToPrecision(
    @NonNull Expression numericExpr,
    @NonNull 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.

```
// Round the value of the 'price' field to the number of decimal places specified in the
// 'precision' field.
roundToPrecision(field("price"), field("precision"))
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |
| `@NonNull Expression decimalPlace` | The number of decimal places to round. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the round operation. |

### roundToPrecision

```
public static final @NonNull Expression roundToPrecision(@NonNull 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.

```
// Round the value of the 'price' field to 2 decimal places.
roundToPrecision(field("price"), 2)
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |
| `int decimalPlace` | The number of decimal places to round. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the round operation. |

### roundToPrecision

```
public static final @NonNull Expression roundToPrecision(
    @NonNull String numericField,
    @NonNull 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.

```
// Round the value of the 'price' field to the number of decimal places specified in the
// 'precision' field.
roundToPrecision("price", field("precision"))
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |
| `@NonNull Expression decimalPlace` | The number of decimal places to round. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the round operation. |

### roundToPrecision

```
public static final @NonNull Expression roundToPrecision(@NonNull 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.

```
// Round the value of the 'price' field to 2 decimal places.
roundToPrecision("price", 2)
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |
| `int decimalPlace` | The number of decimal places to round. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the round operation. |

### rtrim

```
public final @NonNull Expression rtrim()
```

Creates an expression that removes trailing whitespace from this string expression.

```
// Trim trailing whitespace from the 'text' field.
field("text").rtrim()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the rtrim operation. |

### rtrim

```
public static final @NonNull Expression rtrim(@NonNull String fieldName)
```

Creates an expression that removes trailing whitespace from a string field.

```
// Trim trailing whitespace from the 'text' field.
rtrim("text")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to trim. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the rtrim operation. |

### rtrim

```
public static final @NonNull Expression rtrim(@NonNull Expression stringExpression)
```

Creates an expression that removes trailing whitespace from a string expression.

```
// Trim trailing whitespace from the 'text' field.
rtrim(field("text"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to trim. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the rtrim operation. |

### rtrimValue

```
public final @NonNull Expression rtrimValue(@NonNull Expression valuesToTrim)
```

Creates an expression that removes a set of trailing values from this string expression.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim trailing characters defined by the 'chars' field from the 'text' field.
field("text").rtrimValue(field("chars"))
```

| Parameters |
|---|---|
| `@NonNull Expression valuesToTrim` | The expression representing the set of values to remove. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the rtrim operation. |

### rtrimValue

```
public final @NonNull Expression rtrimValue(@NonNull String valuesToTrim)
```

Creates an expression that removes a set of trailing characters from this string expression.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim all trailing '-' and '_' characters from the 'text' field.
field("text").rtrimValue("-_")
```

| Parameters |
|---|---|
| `@NonNull String valuesToTrim` | The set of values to remove. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the rtrim operation. |

### rtrimValue

```
public static final @NonNull Expression rtrimValue(@NonNull String fieldName, @NonNull Expression valuesToTrim)
```

Creates an expression that removes a set of trailing values from a string field.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim trailing characters defined by the 'chars' field from the 'text' field.
rtrimValue("text", field("chars"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to trim. |
| `@NonNull Expression valuesToTrim` | The expression representing the set of values to remove. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the rtrim operation. |

### rtrimValue

```
public static final @NonNull Expression rtrimValue(@NonNull String fieldName, @NonNull String valuesToTrim)
```

Creates an expression that removes a set of trailing values from a string field.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim all trailing '-' and '_' characters from the 'text' field.
rtrimValue("text", "-_")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to trim. |
| `@NonNull String valuesToTrim` | The set of values to remove. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the rtrim operation. |

### rtrimValue

```
public static final @NonNull Expression rtrimValue(
    @NonNull Expression stringExpression,
    @NonNull Expression valuesToTrim
)
```

Creates an expression that removes a set of trailing values from a string expression.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim trailing characters defined by the 'chars' field from the 'text' field.
rtrimValue(field("text"), field("chars"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to trim. |
| `@NonNull Expression valuesToTrim` | The expression representing the set of values to remove. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the rtrim operation. |

### rtrimValue

```
public static final @NonNull Expression rtrimValue(
    @NonNull Expression stringExpression,
    @NonNull String valuesToTrim
)
```

Creates an expression that removes a set of trailing values from a string expression.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim all trailing '-' and '_' characters from the 'text' field.
rtrimValue(field("text"), "-_")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to trim. |
| `@NonNull String valuesToTrim` | The set of values to remove. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the rtrim operation. |

### score

```
public static final @NonNull Expression score()
```

Evaluates to the search score that reflects the topicality of the document to all of the text predicates (for example: `documentMatches`) in the search query. If `SearchStage.query` is not set or does not contain any text predicates, then this score will always be `0`.

Note: This Expression can only be used within a `Search` stage.

```
db.pipeline().collection("restaurants").search(
  SearchStage(query = documentMatches("waffles"), sort = arrayOf(score().descending()))
)
```

### split

```
public final @NonNull Expression split(@NonNull Blob delimiter)
```

Creates an expression that splits this blob expression by a blob delimiter.

```
// Split the 'data' field by a delimiter
field("data").split(Blob.fromBytes(byteArrayOf(0x0a)))
```

| Parameters |
|---|---|
| `@NonNull Blob delimiter` | The blob delimiter to split by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to an array of segments. |

### split

```
public final @NonNull Expression split(@NonNull Expression delimiter)
```

Creates an expression that splits this string or blob expression by a delimiter.

```
// Split the 'tags' field by a comma
field("tags").split(field("delimiter"))
```

| Parameters |
|---|---|
| `@NonNull Expression delimiter` | The delimiter to split by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to an array of segments. |

### split

```
public final @NonNull Expression split(@NonNull String delimiter)
```

Creates an expression that splits this string or blob expression by a string delimiter.

```
// Split the 'tags' field by a comma
field("tags").split(",")
```

| Parameters |
|---|---|
| `@NonNull String delimiter` | The string delimiter to split by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to an array of segments. |

### split

```
public static final @NonNull Expression split(@NonNull String fieldName, @NonNull Blob delimiter)
```

Creates an expression that splits a blob field by a blob delimiter.

```
// Split the 'data' field by a delimiter
split("data", Blob.fromBytes(byteArrayOf(0x0a)))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the blob to be split. |
| `@NonNull Blob delimiter` | The blob delimiter to split by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to an array of segments. |

### split

```
public static final @NonNull Expression split(@NonNull String fieldName, @NonNull Expression delimiter)
```

Creates an expression that splits a string or blob field by a delimiter.

```
// Split the 'tags' field by the value of the 'delimiter' field
split("tags", field("delimiter"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string or blob to be split. |
| `@NonNull Expression delimiter` | The delimiter to split by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to an array of segments. |

### split

```
public static final @NonNull Expression split(@NonNull String fieldName, @NonNull String delimiter)
```

Creates an expression that splits a string or blob field by a string delimiter.

```
// Split the 'tags' field by a comma
split("tags", ",")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string or blob to be split. |
| `@NonNull String delimiter` | The string delimiter to split by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to an array of segments. |

### split

```
public static final @NonNull Expression split(@NonNull Expression value, @NonNull Blob delimiter)
```

Creates an expression that splits a blob by a blob delimiter.

```
// Split the 'data' field by a delimiter
split(field("data"), Blob.fromBytes(byteArrayOf(0x0a)))
```

| Parameters |
|---|---|
| `@NonNull Expression value` | The expression evaluating to a blob to be split. |
| `@NonNull Blob delimiter` | The blob delimiter to split by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to an array of segments. |

### split

```
public static final @NonNull Expression split(@NonNull Expression value, @NonNull Expression delimiter)
```

Creates an expression that splits a string or blob by a delimiter.

```
// Split the 'tags' field by a comma
split(field("tags"), field("delimiter"))
```

| Parameters |
|---|---|
| `@NonNull Expression value` | The expression evaluating to a string or blob to be split. |
| `@NonNull Expression delimiter` | The delimiter to split by. Must be of the same type as `value`. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to an array of segments. |

### split

```
public static final @NonNull Expression split(@NonNull Expression value, @NonNull String delimiter)
```

Creates an expression that splits a string or blob by a string delimiter.

```
// Split the 'tags' field by a comma
split(field("tags"), ",")
```

| Parameters |
|---|---|
| `@NonNull Expression value` | The expression evaluating to a string or blob to be split. |
| `@NonNull String delimiter` | The string delimiter to split by. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` that evaluates to an array of segments. |

### sqrt

```
public final @NonNull Expression sqrt()
```

Creates an expression that returns the square root of this numeric expression.

```
// Compute the square root of the 'value' field.
field("value").sqrt()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the square root operation. |

### sqrt

```
public static final @NonNull Expression sqrt(@NonNull Expression numericExpr)
```

Creates an expression that returns the square root of `numericExpr`.

```
// Compute the square root of the 'value' field.
sqrt(field("value"))
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the square root operation. |

### sqrt

```
public static final @NonNull Expression sqrt(@NonNull String numericField)
```

Creates an expression that returns the square root of `numericField`.

```
// Compute the square root of the 'value' field.
sqrt("value")
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the numeric result of the square root operation. |

### startsWith

```
public final @NonNull BooleanExpression startsWith(@NonNull Expression prefix)
```

Creates an expression that checks if this string expression starts with a given `prefix`.

```
// Check if the 'fullName' field starts with the value of the 'firstName' field
field("fullName").startsWith(field("firstName"))
```

| Parameters |
|---|---|
| `@NonNull Expression prefix` | The prefix string expression to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'starts with' comparison. |

### startsWith

```
public final @NonNull BooleanExpression startsWith(@NonNull String prefix)
```

Creates an expression that checks if this string expression starts with a given `prefix`.

```
// Check if the 'name' field starts with "Mr."
field("name").startsWith("Mr.")
```

| Parameters |
|---|---|
| `@NonNull String prefix` | The prefix string to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'starts with' comparison. |

### startsWith

```
public static final @NonNull BooleanExpression startsWith(@NonNull String fieldName, @NonNull Expression prefix)
```

Creates an expression that checks if a string expression starts with a given `prefix`.

```
// Check if the 'fullName' field starts with the value of the 'firstName' field
startsWith("fullName", field("firstName"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of field that contains a string to check. |
| `@NonNull Expression prefix` | The prefix string expression to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'starts with' comparison. |

### startsWith

```
public static final @NonNull BooleanExpression startsWith(@NonNull String fieldName, @NonNull String prefix)
```

Creates an expression that checks if a string expression starts with a given `prefix`.

```
// Check if the 'name' field starts with "Mr."
startsWith("name", "Mr.")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of field that contains a string to check. |
| `@NonNull String prefix` | The prefix string to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'starts with' comparison. |

### startsWith

```
public static final @NonNull BooleanExpression startsWith(@NonNull Expression stringExpr, @NonNull Expression prefix)
```

```
// Check if the 'fullName' field starts with the value of the 'firstName' field
startsWith(field("fullName"), field("firstName"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpr` | The expression to check. |
| `@NonNull Expression prefix` | The prefix string expression to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'starts with' comparison. |

### startsWith

```
public static final @NonNull BooleanExpression startsWith(@NonNull Expression stringExpr, @NonNull String prefix)
```

Creates an expression that checks if a string expression starts with a given `prefix`.

```
// Check if the 'name' field starts with "Mr."
startsWith(field("name"), "Mr.")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpr` | The expression to check. |
| `@NonNull String prefix` | The prefix string to check for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the 'starts with' comparison. |

### stringConcat

```
public final @NonNull Expression stringConcat(@NonNull Expression stringExpressions)
```

Creates an expression that concatenates string expressions together.

```
// Combine the 'firstName', " ", and 'lastName' fields into a single string
field("firstName").stringConcat(constant(" "), field("lastName"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpressions` | The string expressions to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenated string. |

### stringConcat

```
public final @NonNull Expression stringConcat(@NonNull Object strings)
```

Creates an expression that concatenates string expressions and string constants together.

```
// Combine the 'firstName', " ", and 'lastName' fields into a single string
field("firstName").stringConcat(" ", field("lastName"))
```

| Parameters |
|---|---|
| `@NonNull Object strings` | The string expressions or string constants to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenated string. |

### stringConcat

```
public final @NonNull Expression stringConcat(@NonNull String strings)
```

Creates an expression that concatenates this string expression with string constants.

```
// Combine the 'firstName', " ", and 'lastName' fields into a single string
field("firstName").stringConcat(" ", "lastName")
```

| Parameters |
|---|---|
| `@NonNull String strings` | The string constants to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenated string. |

### stringConcat

```
public static final @NonNull Expression stringConcat(@NonNull String fieldName, @NonNull Object otherStrings)
```

Creates an expression that concatenates string expressions together.

```
// Combine the 'firstName', " ", and 'lastName' fields into a single string
stringConcat("firstName", " ", "lastName")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name containing the initial string value. |
| `@NonNull Object otherStrings` | Optional additional string expressions or string constants to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenated string. |

### stringConcat

```
public static final @NonNull Expression stringConcat(@NonNull String fieldName, @NonNull Expression otherStrings)
```

Creates an expression that concatenates string expressions together.

```
// Combine the 'firstName', " ", and 'lastName' fields into a single string
stringConcat("firstName", constant(" "), field("lastName"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The field name containing the initial string value. |
| `@NonNull Expression otherStrings` | Optional additional string expressions to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenated string. |

### stringConcat

```
public static final @NonNull Expression stringConcat(@NonNull Expression firstString, @NonNull Object otherStrings)
```

Creates an expression that concatenates string expressions together.

```
// Combine the 'firstName', " ", and 'lastName' fields into a single string
stringConcat(field("firstName"), " ", field("lastName"))
```

| Parameters |
|---|---|
| `@NonNull Expression firstString` | The expression representing the initial string value. |
| `@NonNull Object otherStrings` | Optional additional string expressions or string constants to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenated string. |

### stringConcat

```
public static final @NonNull Expression stringConcat(
    @NonNull Expression firstString,
    @NonNull Expression otherStrings
)
```

Creates an expression that concatenates string expressions together.

```
// Combine the 'firstName', " ", and 'lastName' fields into a single string
stringConcat(field("firstName"), constant(" "), field("lastName"))
```

| Parameters |
|---|---|
| `@NonNull Expression firstString` | The expression representing the initial string value. |
| `@NonNull Expression otherStrings` | Optional additional string expressions to concatenate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the concatenated string. |

### stringContains

```
public final @NonNull BooleanExpression stringContains(@NonNull Expression substring)
```

Creates an expression that checks if this string expression contains a specified substring.

```
// Check if the 'description' field contains the value of the 'keyword' field.
field("description").stringContains(field("keyword"))
```

| Parameters |
|---|---|
| `@NonNull Expression substring` | The expression representing the substring to search for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the contains comparison. |

### stringContains

```
public final @NonNull BooleanExpression stringContains(@NonNull String substring)
```

Creates an expression that checks if this string expression contains a specified substring.

```
// Check if the 'description' field contains "example".
field("description").stringContains("example")
```

| Parameters |
|---|---|
| `@NonNull String substring` | The substring to search for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the contains comparison. |

### stringContains

```
public static final @NonNull BooleanExpression stringContains(@NonNull String fieldName, @NonNull Expression substring)
```

Creates an expression that checks if a string field contains a specified substring.

```
// Check if the 'description' field contains the value of the 'keyword' field.
stringContains("description", field("keyword"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field to perform the comparison on. |
| `@NonNull Expression substring` | The expression representing the substring to search for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the contains comparison. |

### stringContains

```
public static final @NonNull BooleanExpression stringContains(@NonNull String fieldName, @NonNull String substring)
```

Creates an expression that checks if a string field contains a specified substring.

```
// Check if the 'description' field contains "example".
stringContains("description", "example")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field to perform the comparison on. |
| `@NonNull String substring` | The substring to search for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the contains comparison. |

### stringContains

```
public static final @NonNull BooleanExpression stringContains(
    @NonNull Expression stringExpression,
    @NonNull Expression substring
)
```

Creates an expression that checks if a string expression contains a specified substring.

```
// Check if the 'description' field contains the value of the 'keyword' field.
stringContains(field("description"), field("keyword"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to perform the comparison on. |
| `@NonNull Expression substring` | The expression representing the substring to search for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the contains comparison. |

### stringContains

```
public static final @NonNull BooleanExpression stringContains(
    @NonNull Expression stringExpression,
    @NonNull String substring
)
```

Creates an expression that checks if a string expression contains a specified substring.

```
// Check if the 'description' field contains "example".
stringContains(field("description"), "example")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to perform the comparison on. |
| `@NonNull String substring` | The substring to search for. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the contains comparison. |

### stringIndexOf

```
public final @NonNull Expression stringIndexOf(@NonNull Expression substring)
```

Creates an expression that returns the 0-based index of the first occurrence of the specified substring.

```
// Get the index of the 'search' field within the 'text' field.
field("text").stringIndexOf(field("search"))
```

| Parameters |
|---|---|
| `@NonNull Expression substring` | The expression representing the substring to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringIndexOf operation. |

### stringIndexOf

```
public final @NonNull Expression stringIndexOf(@NonNull String substring)
```

Creates an expression that returns the 0-based index of the first occurrence of the specified substring.

```
// Get the index of "world" within the 'text' field.
field("text").stringIndexOf("world")
```

| Parameters |
|---|---|
| `@NonNull String substring` | The substring to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringIndexOf operation. |

### stringIndexOf

```
public static final @NonNull Expression stringIndexOf(@NonNull String fieldName, @NonNull Expression substring)
```

Creates an expression that returns the 0-based index of the first occurrence of the specified substring in a field.

```
// Get the index of the 'search' field within the 'text' field.
stringIndexOf("text", field("search"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to search within. |
| `@NonNull Expression substring` | The expression representing the substring to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringIndexOf operation. |

### stringIndexOf

```
public static final @NonNull Expression stringIndexOf(@NonNull String fieldName, @NonNull String substring)
```

Creates an expression that returns the 0-based index of the first occurrence of the specified substring in a field.

```
// Get the index of "world" within the 'text' field.
stringIndexOf("text", "world")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to search within. |
| `@NonNull String substring` | The substring to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringIndexOf operation. |

### stringIndexOf

```
public static final @NonNull Expression stringIndexOf(
    @NonNull Expression stringExpression,
    @NonNull Expression substring
)
```

Creates an expression that returns the 0-based index of the first occurrence of the specified substring.

```
// Get the index of the 'search' field within the 'text' field.
stringIndexOf(field("text"), field("search"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to search within. |
| `@NonNull Expression substring` | The expression representing the substring to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringIndexOf operation. |

### stringIndexOf

```
public static final @NonNull Expression stringIndexOf(
    @NonNull Expression stringExpression,
    @NonNull String substring
)
```

Creates an expression that returns the 0-based index of the first occurrence of the specified substring.

```
// Get the index of "world" within the 'text' field.
stringIndexOf(field("text"), "world")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to search within. |
| `@NonNull String substring` | The substring to search for. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringIndexOf operation. |

### stringRepeat

```
public final @NonNull Expression stringRepeat(@NonNull Expression count)
```

Creates an expression that repeats this string expression a given number of times.

```
// Repeat the 'name' field the number of times specified in the 'count' field.
field("name").stringRepeat(field("count"))
```

| Parameters |
|---|---|
| `@NonNull Expression count` | The expression representing the number of times to repeat the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringRepeat operation. |

### stringRepeat

```
public final @NonNull Expression stringRepeat(int count)
```

Creates an expression that repeats this string expression a given number of times.

```
// Repeat the 'name' field 3 times.
field("name").stringRepeat(3)
```

| Parameters |
|---|---|
| `int count` | The number of times to repeat the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringRepeat operation. |

### stringRepeat

```
public static final @NonNull Expression stringRepeat(@NonNull String fieldName, @NonNull Expression count)
```

Creates an expression that repeats a string field a given number of times.

```
// Repeat the 'name' field the number of times specified in the 'count' field.
stringRepeat("name", field("count"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to repeat. |
| `@NonNull Expression count` | The expression representing the number of times to repeat the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringRepeat operation. |

### stringRepeat

```
public static final @NonNull Expression stringRepeat(@NonNull String fieldName, int count)
```

Creates an expression that repeats a string field a given number of times.

```
// Repeat the 'name' field 3 times.
stringRepeat("name", 3)
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to repeat. |
| `int count` | The number of times to repeat the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringRepeat operation. |

### stringRepeat

```
public static final @NonNull Expression stringRepeat(
    @NonNull Expression stringExpression,
    @NonNull Expression count
)
```

Creates an expression that repeats a string expression a given number of times.

```
// Repeat the 'name' field the number of times specified in the 'count' field.
stringRepeat(field("name"), field("count"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to repeat. |
| `@NonNull Expression count` | The expression representing the number of times to repeat the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringRepeat operation. |

### stringRepeat

```
public static final @NonNull Expression stringRepeat(@NonNull Expression stringExpression, int count)
```

Creates an expression that repeats a string expression a given number of times.

```
// Repeat the 'name' field 3 times.
stringRepeat(field("name"), 3)
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to repeat. |
| `int count` | The number of times to repeat the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringRepeat operation. |

### stringReplaceAll

```
public final @NonNull Expression stringReplaceAll(
    @NonNull Expression oldValue,
    @NonNull Expression newValue
)
```

Creates an expression that replaces all occurrences of a substring with another string.

```
// Replace all occurrences of the 'old' field with the 'new' field in 'text'.
field("text").stringReplaceAll(field("old"), field("new"))
```

| Parameters |
|---|---|
| `@NonNull Expression oldValue` | The expression representing the substring to replace. |
| `@NonNull Expression newValue` | The expression representing the replacement string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReplaceAll operation. |

### stringReplaceAll

```
public final @NonNull Expression stringReplaceAll(@NonNull String oldValue, @NonNull String newValue)
```

Creates an expression that replaces all occurrences of a substring with another string.

```
// Replace all occurrences of "cat" with "dog" in the 'text' field.
field("text").stringReplaceAll("cat", "dog")
```

| Parameters |
|---|---|
| `@NonNull String oldValue` | The substring to replace. |
| `@NonNull String newValue` | The replacement string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReplaceAll operation. |

### stringReplaceAll

```
public static final @NonNull Expression stringReplaceAll(
    @NonNull String fieldName,
    @NonNull Expression oldValue,
    @NonNull Expression newValue
)
```

Creates an expression that replaces all occurrences of a substring with another string in a field.

```
// Replace all occurrences of the 'old' field with the 'new' field in 'text'.
stringReplaceAll("text", field("old"), field("new"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the original string. |
| `@NonNull Expression oldValue` | The expression representing the substring to replace. |
| `@NonNull Expression newValue` | The expression representing the replacement string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReplaceAll operation. |

### stringReplaceAll

```
public static final @NonNull Expression stringReplaceAll(
    @NonNull String fieldName,
    @NonNull String oldValue,
    @NonNull String newValue
)
```

Creates an expression that replaces all occurrences of a substring with another string in a field.

```
// Replace all occurrences of "cat" with "dog" in the 'text' field.
stringReplaceAll("text", "cat", "dog")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the original string. |
| `@NonNull String oldValue` | The substring to replace. |
| `@NonNull String newValue` | The replacement string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReplaceAll operation. |

### stringReplaceAll

```
public static final @NonNull Expression stringReplaceAll(
    @NonNull Expression stringExpression,
    @NonNull Expression oldValue,
    @NonNull Expression newValue
)
```

Creates an expression that replaces all occurrences of a substring with another string.

```
// Replace all occurrences of the 'old' field with the 'new' field in 'text'.
stringReplaceAll(field("text"), field("old"), field("new"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the original string. |
| `@NonNull Expression oldValue` | The expression representing the substring to replace. |
| `@NonNull Expression newValue` | The expression representing the replacement string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReplaceAll operation. |

### stringReplaceAll

```
public static final @NonNull Expression stringReplaceAll(
    @NonNull Expression stringExpression,
    @NonNull String oldValue,
    @NonNull String newValue
)
```

Creates an expression that replaces all occurrences of a substring with another string.

```
// Replace all occurrences of "cat" with "dog" in the 'text' field.
stringReplaceAll(field("text"), "cat", "dog")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the original string. |
| `@NonNull String oldValue` | The substring to replace. |
| `@NonNull String newValue` | The replacement string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReplaceAll operation. |

### stringReplaceOne

```
public final @NonNull Expression stringReplaceOne(
    @NonNull Expression oldValue,
    @NonNull Expression newValue
)
```

Creates an expression that replaces the first occurrence of a substring with another string.

```
// Replace the first occurrence of the 'old' field with the 'new' field in 'text'.
field("text").stringReplaceOne(field("old"), field("new"))
```

| Parameters |
|---|---|
| `@NonNull Expression oldValue` | The expression representing the substring to replace. |
| `@NonNull Expression newValue` | The expression representing the replacement string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReplaceOne operation. |

### stringReplaceOne

```
public final @NonNull Expression stringReplaceOne(@NonNull String oldValue, @NonNull String newValue)
```

Creates an expression that replaces the first occurrence of a substring with another string.

```
// Replace the first occurrence of "cat" with "dog" in the 'text' field.
field("text").stringReplaceOne("cat", "dog")
```

| Parameters |
|---|---|
| `@NonNull String oldValue` | The substring to replace. |
| `@NonNull String newValue` | The replacement string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReplaceOne operation. |

### stringReplaceOne

```
public static final @NonNull Expression stringReplaceOne(
    @NonNull String fieldName,
    @NonNull Expression oldValue,
    @NonNull Expression newValue
)
```

Creates an expression that replaces the first occurrence of a substring with another string in a field.

```
// Replace the first occurrence of the 'old' field with the 'new' field in 'text'.
stringReplaceOne("text", field("old"), field("new"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the original string. |
| `@NonNull Expression oldValue` | The expression representing the substring to replace. |
| `@NonNull Expression newValue` | The expression representing the replacement string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReplaceOne operation. |

### stringReplaceOne

```
public static final @NonNull Expression stringReplaceOne(
    @NonNull String fieldName,
    @NonNull String oldValue,
    @NonNull String newValue
)
```

Creates an expression that replaces the first occurrence of a substring with another string in a field.

```
// Replace the first occurrence of "cat" with "dog" in the 'text' field.
stringReplaceOne("text", "cat", "dog")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the original string. |
| `@NonNull String oldValue` | The substring to replace. |
| `@NonNull String newValue` | The replacement string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReplaceOne operation. |

### stringReplaceOne

```
public static final @NonNull Expression stringReplaceOne(
    @NonNull Expression stringExpression,
    @NonNull Expression oldValue,
    @NonNull Expression newValue
)
```

Creates an expression that replaces the first occurrence of a substring with another string.

```
// Replace the first occurrence of the 'old' field with the 'new' field in 'text'.
stringReplaceOne(field("text"), field("old"), field("new"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the original string. |
| `@NonNull Expression oldValue` | The expression representing the substring to replace. |
| `@NonNull Expression newValue` | The expression representing the replacement string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReplaceOne operation. |

### stringReplaceOne

```
public static final @NonNull Expression stringReplaceOne(
    @NonNull Expression stringExpression,
    @NonNull String oldValue,
    @NonNull String newValue
)
```

Creates an expression that replaces the first occurrence of a substring with another string.

```
// Replace the first occurrence of "cat" with "dog" in the 'text' field.
stringReplaceOne(field("text"), "cat", "dog")
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the original string. |
| `@NonNull String oldValue` | The substring to replace. |
| `@NonNull String newValue` | The replacement string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReplaceOne operation. |

### stringReverse

```
public final @NonNull Expression stringReverse()
```

Creates an expression that performs a reverse operation on this string expression.

```
// reverse the field "filename": "abc.txt" => "txt.cba"
field("filename").stringReverse()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the 'stringReverse' operation. |

### stringReverse

```
public static final @NonNull Expression stringReverse(@NonNull String fieldName)
```

Reverses the given string field.

```
// Reverse the value of the 'myString' field.
stringReverse("myString")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of field that contains the string to reverse. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReverse operation. |

### stringReverse

```
public static final @NonNull Expression stringReverse(@NonNull Expression str)
```

Reverses the given string expression.

```
// Reverse the value of the 'myString' field.
stringReverse(field("myString"))
```

| Parameters |
|---|---|
| `@NonNull Expression str` | The string expression to reverse. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the stringReverse operation. |

### substring

```
public final @NonNull Expression substring(@NonNull Expression start, @NonNull Expression length)
```

Creates an expression that returns a substring of the given string.

```
// Get a substring of the 'message' field starting at index 5 with length 10.
field("message").substring(constant(5), constant(10))
```

| Parameters |
|---|---|
| `@NonNull Expression start` | The starting index of the substring. |
| `@NonNull Expression length` | The length of the substring. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the substring. |

### substring

```
public final @NonNull Expression substring(int start, int length)
```

Creates an expression that returns a substring of the given string.

```
// Get a substring of the 'message' field starting at index 5 with length 10.
field("message").substring(5, 10)
```

| Parameters |
|---|---|
| `int start` | The starting index of the substring. |
| `int length` | The length of the substring. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the substring. |

### substring

```
public static final @NonNull Expression substring(@NonNull String fieldName, int index, int length)
```

Creates an expression that returns a substring of the given string.

```
// Get a substring of the 'message' field starting at index 5 with length 10.
substring("message", 5, 10)
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to get a substring from. |
| `int index` | The starting index of the substring. |
| `int length` | The length of the substring. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the substring. |

### substring

```
public static final @NonNull Expression substring(
    @NonNull Expression stringExpression,
    @NonNull Expression index,
    @NonNull Expression length
)
```

Creates an expression that returns a substring of the given string.

```
// Get a substring of the 'message' field starting at index 5 with length 10.
substring(field("message"), constant(5), constant(10))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to get a substring from. |
| `@NonNull Expression index` | The starting index of the substring. |
| `@NonNull Expression length` | The length of the substring. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the substring. |

### subtract

```
public final @NonNull Expression subtract(@NonNull Expression subtrahend)
```

Creates an expression that subtracts a constant from this numeric expression.

```
// Subtract the 'discount' field from the 'price' field
field("price").subtract(field("discount"))
```

| Parameters |
|---|---|
| `@NonNull Expression subtrahend` | Numeric expression to subtract. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the subtract operation. |

### subtract

```
public final @NonNull Expression subtract(@NonNull Number subtrahend)
```

Creates an expression that subtracts a numeric expressions from this numeric expression.

```
// Subtract 10 from the 'price' field.
field("price").subtract(10)
```

| Parameters |
|---|---|
| `@NonNull Number subtrahend` | Constant to subtract. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the subtract operation. |

### subtract

```
public static final @NonNull Expression subtract(@NonNull Expression minuend, @NonNull Expression subtrahend)
```

Creates an expression that subtracts two expressions.

```
// Subtract the 'discount' field from the 'price' field
subtract(field("price"), field("discount"))
```

| Parameters |
|---|---|
| `@NonNull Expression minuend` | Numeric expression to subtract from. |
| `@NonNull Expression subtrahend` | Numeric expression to subtract. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the subtract operation. |

### subtract

```
public static final @NonNull Expression subtract(@NonNull Expression minuend, @NonNull Number subtrahend)
```

Creates an expression that subtracts a constant value from a numeric expression.

```
// Subtract 10 from the 'price' field.
subtract(field("price"), 10)
```

| Parameters |
|---|---|
| `@NonNull Expression minuend` | Numeric expression to subtract from. |
| `@NonNull Number subtrahend` | Constant to subtract. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the subtract operation. |

### subtract

```
public static final @NonNull Expression subtract(@NonNull String numericFieldName, @NonNull Expression subtrahend)
```

Creates an expression that subtracts a numeric expressions from numeric field.

```
// Subtract the 'discount' field from the 'price' field.
subtract("price", field("discount"))
```

| Parameters |
|---|---|
| `@NonNull String numericFieldName` | Numeric field to subtract from. |
| `@NonNull Expression subtrahend` | Numeric expression to subtract. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the subtract operation. |

### subtract

```
public static final @NonNull Expression subtract(@NonNull String numericFieldName, @NonNull Number subtrahend)
```

Creates an expression that subtracts a constant from numeric field.

```
// Subtract 10 from the 'price' field.
subtract("price", 10)
```

| Parameters |
|---|---|
| `@NonNull String numericFieldName` | Numeric field to subtract from. |
| `@NonNull Number subtrahend` | Constant to subtract. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the subtract operation. |

### sum

```
public final @NonNull AggregateFunction sum()
```

Creates an aggregation that calculates the sum of this numeric expression across multiple stage inputs.

| Returns |
|---|---|
| `@NonNull AggregateFunction` | A new `AggregateFunction` representing the sum aggregation. |

### switchOn

```
public static final @NonNull Expression switchOn(
    @NonNull BooleanExpression condition,
    @NonNull Object result,
    @NonNull Object others
)
```

Creates an expression that evaluates to the result corresponding to the first true condition.

This function behaves like a `switch` statement. It accepts an alternating sequence of conditions and their corresponding results. If an odd number of arguments is provided, the final argument serves as a default fallback result. If no default is provided and no condition evaluates to true, it throws an error.

```
// Return "Active" if field "status" is 1, "Pending" if field "status" is 2,
// and default to "Unknown" if none of the conditions are true.
switchOn(
  field("status").equal(1), constant("Active"),
  field("status").equal(2), constant("Pending"),
  constant("Unknown")
)
```

| Parameters |
|---|---|
| `@NonNull BooleanExpression condition` | The first condition to check. |
| `@NonNull Object result` | The result if the first condition is true. |
| `@NonNull Object others` | Additional conditions and results, and optionally a default value. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the switch operation. |

### timestampAdd

```
public final @NonNull Expression timestampAdd(@NonNull Expression unit, @NonNull Expression amount)
```

Creates an expression that adds a specified amount of time to this timestamp expression.

```
// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field.
field("timestamp").timestampAdd(field("unit"), field("amount"))
```

| Parameters |
|---|---|
| `@NonNull Expression unit` | The expression representing the unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
| `@NonNull Expression amount` | The expression representing the amount of time to add. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the resulting timestamp. |

### timestampAdd

```
public final @NonNull Expression timestampAdd(@NonNull String unit, long amount)
```

Creates an expression that adds a specified amount of time to this timestamp expression.

```
// Add 1 day to the 'timestamp' field.
field("timestamp").timestampAdd("day", 1)
```

| Parameters |
|---|---|
| `@NonNull String unit` | The unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
| `long amount` | The amount of time to add. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the resulting timestamp. |

### timestampAdd

```
public static final @NonNull Expression timestampAdd(
    @NonNull String fieldName,
    @NonNull Expression unit,
    @NonNull Expression amount
)
```

Creates an expression that adds a specified amount of time to a timestamp.

```
// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field.
timestampAdd("timestamp", field("unit"), field("amount"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field that contains the timestamp. |
| `@NonNull Expression unit` | The expression representing the unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
| `@NonNull Expression amount` | The expression representing the amount of time to add. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the resulting timestamp. |

### timestampAdd

```
public static final @NonNull Expression timestampAdd(@NonNull String fieldName, @NonNull String unit, long amount)
```

Creates an expression that adds a specified amount of time to a timestamp.

```
// Add 1 day to the 'timestamp' field.
timestampAdd("timestamp", "day", 1)
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field that contains the timestamp. |
| `@NonNull String unit` | The unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
| `long amount` | The amount of time to add. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the resulting timestamp. |

### timestampAdd

```
public static final @NonNull Expression timestampAdd(
    @NonNull Expression timestamp,
    @NonNull Expression unit,
    @NonNull Expression amount
)
```

Creates an expression that adds a specified amount of time to a timestamp.

```
// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field.
timestampAdd(field("timestamp"), field("unit"), field("amount"))
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The expression representing the timestamp. |
| `@NonNull Expression unit` | The expression representing the unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
| `@NonNull Expression amount` | The expression representing the amount of time to add. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the resulting timestamp. |

### timestampAdd

```
public static final @NonNull Expression timestampAdd(
    @NonNull Expression timestamp,
    @NonNull String unit,
    long amount
)
```

Creates an expression that adds a specified amount of time to a timestamp.

```
// Add 1 day to the 'timestamp' field.
timestampAdd(field("timestamp"), "day", 1)
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The expression representing the timestamp. |
| `@NonNull String unit` | The unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
| `long amount` | The amount of time to add. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the resulting timestamp. |

### timestampDiff

```
public final @NonNull Expression timestampDiff(@NonNull Expression start, @NonNull Expression unit)
```

Calculates the difference between this timestamp and another timestamp.

```
// Calculate the difference determined by fields 'startAt' and 'unit'.
field("endAt").timestampDiff(field("startAt"), field("unit"))
```

| Parameters |
|---|---|
| `@NonNull Expression start` | The starting timestamp expression. |
| `@NonNull Expression unit` | The unit of time for the difference. Valid values include "microsecond", "millisecond", "second", "minute", "hour" and "day". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the difference. |

### timestampDiff

```
public final @NonNull Expression timestampDiff(@NonNull Expression start, @NonNull String unit)
```

Calculates the difference between this timestamp and another timestamp.

```
// Calculate the difference in days between 'endAt' and 'startAt' fields.
field("endAt").timestampDiff(field("startAt"), "day")
```

| Parameters |
|---|---|
| `@NonNull Expression start` | The starting timestamp expression. |
| `@NonNull String unit` | The unit of time for the difference. Valid values include "microsecond", "millisecond", "second", "minute", "hour" and "day". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the difference. |

### timestampDiff

```
public final @NonNull Expression timestampDiff(@NonNull String startFieldName, @NonNull String unit)
```

Calculates the difference between this timestamp and another timestamp.

```
// Calculate the difference in days between 'endAt' and 'startAt' fields.
field("endAt").timestampDiff("startAt", "day")
```

| Parameters |
|---|---|
| `@NonNull String startFieldName` | The starting timestamp field name. |
| `@NonNull String unit` | The unit of time for the difference. Valid values include "microsecond", "millisecond", "second", "minute", "hour" and "day". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the difference. |

### timestampDiff

```
public static final @NonNull Expression timestampDiff(
    @NonNull Expression end,
    @NonNull Expression start,
    @NonNull Expression unit
)
```

Creates an expression that calculates the difference between two timestamps.

```
// Calculate the difference between the fields 'endAt' and the field 'startAt' in unit specified by
// the 'unit' field.
timestampDiff(field("endAt"), field("startAt"), field("unit"))
```

| Parameters |
|---|---|
| `@NonNull Expression end` | The ending timestamp expression. |
| `@NonNull Expression start` | The starting timestamp expression. |
| `@NonNull Expression unit` | The unit of time for the difference. Valid values include "microsecond", "millisecond", "second", "minute", "hour" and "day". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the difference. |

### timestampDiff

```
public static final @NonNull Expression timestampDiff(
    @NonNull Expression end,
    @NonNull Expression start,
    @NonNull String unit
)
```

Creates an expression that calculates the difference between two timestamps.

```
// Calculate the difference in days between 'endAt' field and 'startAt' field.
timestampDiff(field("endAt"), field("startAt"), "day")
```

| Parameters |
|---|---|
| `@NonNull Expression end` | The ending timestamp expression. |
| `@NonNull Expression start` | The starting timestamp expression. |
| `@NonNull String unit` | The unit of time for the difference. Valid values include "microsecond", "millisecond", "second", "minute", "hour" and "day". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the difference. |

### timestampDiff

```
public static final @NonNull Expression timestampDiff(
    @NonNull Expression end,
    @NonNull String startFieldName,
    @NonNull String unit
)
```

Creates an expression that calculates the difference between two timestamps.

```
// Calculate the difference in days between 'endAt' and 'startAt'.
timestampDiff(field("endAt"), "startAt", "day")
```

| Parameters |
|---|---|
| `@NonNull Expression end` | The ending timestamp expression. |
| `@NonNull String startFieldName` | The starting timestamp field name. |
| `@NonNull String unit` | The unit of time for the difference. Valid values include "microsecond", "millisecond", "second", "minute", "hour" and "day". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the difference. |

### timestampDiff

```
public static final @NonNull Expression timestampDiff(
    @NonNull String endFieldName,
    @NonNull Expression start,
    @NonNull String unit
)
```

Creates an expression that calculates the difference between two timestamps.

```
// Calculate the difference in days between 'endAt' and 'startAt'.
timestampDiff("endAt", field("startAt"), "day")
```

| Parameters |
|---|---|
| `@NonNull String endFieldName` | The ending timestamp field name. |
| `@NonNull Expression start` | The starting timestamp expression. |
| `@NonNull String unit` | The unit of time for the difference. Valid values include "microsecond", "millisecond", "second", "minute", "hour" and "day". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the difference. |

### timestampDiff

```
public static final @NonNull Expression timestampDiff(
    @NonNull String endFieldName,
    @NonNull String startFieldName,
    @NonNull String unit
)
```

Creates an expression that calculates the difference between two timestamps.

```
// Calculate the difference in days between 'endAt' and 'startAt'.
timestampDiff("endAt", "startAt", "day")
```

| Parameters |
|---|---|
| `@NonNull String endFieldName` | The ending timestamp field name. |
| `@NonNull String startFieldName` | The starting timestamp field name. |
| `@NonNull String unit` | The unit of time for the difference. Valid values include "microsecond", "millisecond", "second", "minute", "hour" and "day". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the difference. |

### timestampExtract

```
public final @NonNull Expression timestampExtract(@NonNull Expression part)
```

Creates an expression that extracts a specified part from this timestamp expression.

```
// Extract the part specified by the field 'part' from 'timestamp'.
field("timestamp").timestampExtract(field("part"))
```

| Parameters |
|---|---|
| `@NonNull Expression part` | The part to extract. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtract

```
public final @NonNull Expression timestampExtract(@NonNull String part)
```

Creates an expression that extracts a specified part from this timestamp expression.

```
// Extract the day from the timestamp in the 'timestamp' field.
field("timestamp").timestampExtract("day")
```

| Parameters |
|---|---|
| `@NonNull String part` | The part to extract. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtract

```
public static final @NonNull Expression timestampExtract(@NonNull String fieldName, @NonNull Expression part)
```

Creates an expression that extracts a specified part from a timestamp.

```
// Extract the part specified by the field 'part' from 'createdAt'.
timestampExtract("createdAt", field("part"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the timestamp. |
| `@NonNull Expression part` | The part to extract from the timestamp. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtract

```
public static final @NonNull Expression timestampExtract(@NonNull String fieldName, @NonNull String part)
```

Creates an expression that extracts a specified part from a timestamp.

```
// Extract the day from the timestamp in the 'createdAt' field.
timestampExtract("createdAt", "day")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the timestamp. |
| `@NonNull String part` | The part to extract from the timestamp. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtract

```
public static final @NonNull Expression timestampExtract(@NonNull Expression timestamp, @NonNull Expression part)
```

Creates an expression that extracts a specified part from a timestamp.

```
// Extract the part specified by the field 'part' from 'createdAt'.
timestampExtract(field("createdAt"), field("part"))
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The timestamp expression. |
| `@NonNull Expression part` | The part to extract from the timestamp. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtract

```
public static final @NonNull Expression timestampExtract(@NonNull Expression timestamp, @NonNull String part)
```

Creates an expression that extracts a specified part from a timestamp.

```
// Extract the day from the timestamp returned by the expression.
timestampExtract(field("createdAt"), "day")
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The timestamp expression. |
| `@NonNull String part` | The part to extract from the timestamp. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtractWithTimezone

```
public final @NonNull Expression timestampExtractWithTimezone(
    @NonNull Expression part,
    @NonNull Expression timezone
)
```

Creates an expression that extracts a specified part from this timestamp expression in a given timezone.

```
// Extract the part specified by the field 'part' from 'timestamp' in timezone specified by
the field 'tz'.
field("timestamp").timestampExtractWithTimezone(field("part"), field("tz"))
```

| Parameters |
|---|---|
| `@NonNull Expression part` | The part to extract. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| `@NonNull Expression timezone` | The timezone expression to use for extraction. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". Defaults to "UTC" if not specified. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtractWithTimezone

```
public final @NonNull Expression timestampExtractWithTimezone(
    @NonNull Expression part,
    @NonNull String timezone
)
```

Creates an expression that extracts a specified part from this timestamp expression in a given timezone.

```
// Extract the part specified by the field 'part' from 'timestamp' in timezone 'America/Los_Angeles'.
field("timestamp").timestampExtractWithTimezone(field("part"), "America/Los_Angeles")
```

| Parameters |
|---|---|
| `@NonNull Expression part` | The part to extract. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| `@NonNull String timezone` | The timezone to use for extraction. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". Defaults to "UTC" if not specified. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtractWithTimezone

```
public final @NonNull Expression timestampExtractWithTimezone(
    @NonNull String part,
    @NonNull Expression timezone
)
```

Creates an expression that extracts a specified part from this timestamp expression in a given timezone.

```
// Extract the day from the timestamp in the 'timestamp' field in timezone specified by
the field 'tz'.
field("timestamp").timestampExtractWithTimezone("day", field("tz"))
```

| Parameters |
|---|---|
| `@NonNull String part` | The part to extract. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| `@NonNull Expression timezone` | The timezone expression to use for extraction. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". Defaults to "UTC" if not specified. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtractWithTimezone

```
public final @NonNull Expression timestampExtractWithTimezone(
    @NonNull String part,
    @NonNull String timezone
)
```

Creates an expression that extracts a specified part from this timestamp expression in a given timezone.

```
// Extract the day from the timestamp in the 'timestamp' field in timezone 'America/Los_Angeles'.
field("timestamp").timestampExtractWithTimezone("day", "America/Los_Angeles")
```

| Parameters |
|---|---|
| `@NonNull String part` | The part to extract. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| `@NonNull String timezone` | The timezone to use for extraction. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". Defaults to "UTC" if not specified. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtractWithTimezone

```
public static final @NonNull Expression timestampExtractWithTimezone(
    @NonNull String fieldName,
    @NonNull Expression part,
    @NonNull Expression timezone
)
```

Creates an expression that extracts a specified part from a timestamp in a given timezone.

```
// Extract the part specified by the field 'part' from 'createdAt' in the timezone specified by the 'tz' field.
timestampExtractWithTimezone("createdAt", field("part"), field("tz"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the timestamp. |
| `@NonNull Expression part` | The part to extract from the timestamp. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| `@NonNull Expression timezone` | The timezone expression to use for extraction.Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". Defaults to "UTC" if not specified. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtractWithTimezone

```
public static final @NonNull Expression timestampExtractWithTimezone(
    @NonNull String fieldName,
    @NonNull Expression part,
    @NonNull String timezone
)
```

Creates an expression that extracts a specified part from a timestamp in a given timezone.

```
// Extract the part specified by the field 'part' from 'createdAt' in the timezone "America/Los_Angeles".
timestampExtractWithTimezone("createdAt", field("part"), "America/Los_Angeles")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the timestamp. |
| `@NonNull Expression part` | The part to extract from the timestamp. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| `@NonNull String timezone` | The timezone expression to use for extraction.Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". Defaults to "UTC" if not specified. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtractWithTimezone

```
public static final @NonNull Expression timestampExtractWithTimezone(
    @NonNull String fieldName,
    @NonNull String part,
    @NonNull Expression timezone
)
```

Creates an expression that extracts a specified part from a timestamp in a given timezone.

```
// Extract the day from the timestamp in the 'createdAt' field in the timezone specified by the 'tz' field.
timestampExtractWithTimezone("createdAt", "day", field("tz"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the timestamp. |
| `@NonNull String part` | The part to extract from the timestamp. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| `@NonNull Expression timezone` | The timezone expression to use for extraction.Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". Defaults to "UTC" if not specified. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtractWithTimezone

```
public static final @NonNull Expression timestampExtractWithTimezone(
    @NonNull String fieldName,
    @NonNull String part,
    @NonNull String timezone
)
```

Creates an expression that extracts a specified part from a timestamp in a given timezone.

```
// Extract the day from the timestamp in the 'createdAt' field in the timezone "America/Los_Angeles".
timestampExtractWithTimezone("createdAt", "day", "America/Los_Angeles")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the timestamp. |
| `@NonNull String part` | The part to extract from the timestamp. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| `@NonNull String timezone` | The timezone expression to use for extraction.Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". Defaults to "UTC" if not specified. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtractWithTimezone

```
public static final @NonNull Expression timestampExtractWithTimezone(
    @NonNull Expression timestamp,
    @NonNull Expression part,
    @NonNull Expression timezone
)
```

Creates an expression that extracts a specified part from a timestamp in a given timezone.

```
// Extract the part specified by the field 'part' from 'createdAt' in the timezone specified by
// the field 'tz'.
timestampExtractWithTimezone(field("createdAt"), field("part"), field("tz"))
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The timestamp expression. |
| `@NonNull Expression part` | The part to extract from the timestamp. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| `@NonNull Expression timezone` | The timezone expression to use for extraction.Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". Defaults to "UTC" if not specified. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtractWithTimezone

```
public static final @NonNull Expression timestampExtractWithTimezone(
    @NonNull Expression timestamp,
    @NonNull Expression part,
    @NonNull String timezone
)
```

Creates an expression that extracts a specified part from a timestamp in a given timezone.

```
// Extract the part specified by the field 'part' from 'createdAt' in the timezone "America/Los_Angeles".
timestampExtractWithTimezone(field("createdAt"), field("part"), "America/Los_Angeles")
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The timestamp expression. |
| `@NonNull Expression part` | The part to extract from the timestamp. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| `@NonNull String timezone` | The timezone expression to use for extraction.Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". Defaults to "UTC" if not specified. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtractWithTimezone

```
public static final @NonNull Expression timestampExtractWithTimezone(
    @NonNull Expression timestamp,
    @NonNull String part,
    @NonNull Expression timezone
)
```

Creates an expression that extracts a specified part from a timestamp in a given timezone.

```
// Extract the day from the timestamp in the 'createdAt' field in the timezone specified by the 'tz' field.
timestampExtractWithTimezone(field("createdAt"), "day", field("tz"))
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The timestamp expression. |
| `@NonNull String part` | The part to extract from the timestamp. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| `@NonNull Expression timezone` | The timezone expression to use for extraction.Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". Defaults to "UTC" if not specified. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampExtractWithTimezone

```
public static final @NonNull Expression timestampExtractWithTimezone(
    @NonNull Expression timestamp,
    @NonNull String part,
    @NonNull String timezone
)
```

Creates an expression that extracts a specified part from a timestamp in a given timezone.

```
// Extract the day from the timestamp in the 'createdAt' field in the timezone "America/Los_Angeles".
timestampExtractWithTimezone(field("createdAt"), "day", "America/Los_Angeles")
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The timestamp expression. |
| `@NonNull String part` | The part to extract from the timestamp. Valid values are "microsecond", "millisecond", "second", "minute", "hour", "dayofweek", "day", "dayofyear", "week", "week(monday)", "week(tuesday)", "week(wednesday)", "week(thursday)", "week(friday)", "week(saturday)", "week(sunday)", "isoweek", "month", "quarter", "year", and "isoyear". |
| `@NonNull String timezone` | The timezone expression to use for extraction.Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". Defaults to "UTC" if not specified. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the extracted part. |

### timestampSubtract

```
public final @NonNull Expression timestampSubtract(@NonNull Expression unit, @NonNull Expression amount)
```

Creates an expression that subtracts a specified amount of time to this timestamp expression.

```
// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field.
field("timestamp").timestampSubtract(field("unit"), field("amount"))
```

| Parameters |
|---|---|
| `@NonNull Expression unit` | The expression representing the unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
| `@NonNull Expression amount` | The expression representing the amount of time to subtract. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the resulting timestamp. |

### timestampSubtract

```
public final @NonNull Expression timestampSubtract(@NonNull String unit, long amount)
```

Creates an expression that subtracts a specified amount of time to this timestamp expression.

```
// Subtract 1 day from the 'timestamp' field.
field("timestamp").timestampSubtract("day", 1)
```

| Parameters |
|---|---|
| `@NonNull String unit` | The unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
| `long amount` | The amount of time to subtract. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the resulting timestamp. |

### timestampSubtract

```
public static final @NonNull Expression timestampSubtract(
    @NonNull String fieldName,
    @NonNull Expression unit,
    @NonNull Expression amount
)
```

Creates an expression that subtracts a specified amount of time to a timestamp.

```
// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field.
timestampSubtract("timestamp", field("unit"), field("amount"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field that contains the timestamp. |
| `@NonNull Expression unit` | The unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
| `@NonNull Expression amount` | The amount of time to subtract. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the resulting timestamp. |

### timestampSubtract

```
public static final @NonNull Expression timestampSubtract(
    @NonNull String fieldName,
    @NonNull String unit,
    long amount
)
```

Creates an expression that subtracts a specified amount of time to a timestamp.

```
// Subtract 1 day from the 'timestamp' field.
timestampSubtract("timestamp", "day", 1)
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field that contains the timestamp. |
| `@NonNull String unit` | The unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
| `long amount` | The amount of time to subtract. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the resulting timestamp. |

### timestampSubtract

```
public static final @NonNull Expression timestampSubtract(
    @NonNull Expression timestamp,
    @NonNull Expression unit,
    @NonNull Expression amount
)
```

Creates an expression that subtracts a specified amount of time to a timestamp.

```
// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field.
timestampSubtract(field("timestamp"), field("unit"), field("amount"))
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The expression representing the timestamp. |
| `@NonNull Expression unit` | The expression representing the unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
| `@NonNull Expression amount` | The expression representing the amount of time to subtract. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the resulting timestamp. |

### timestampSubtract

```
public static final @NonNull Expression timestampSubtract(
    @NonNull Expression timestamp,
    @NonNull String unit,
    long amount
)
```

Creates an expression that subtracts a specified amount of time to a timestamp.

```
// Subtract 1 day from the 'timestamp' field.
timestampSubtract(field("timestamp"), "day", 1)
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The expression representing the timestamp. |
| `@NonNull String unit` | The unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day". |
| `long amount` | The amount of time to subtract. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the resulting timestamp. |

### timestampToUnixMicros

```
public final @NonNull 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).

```
// Convert the 'timestamp' field to microseconds since epoch.
field("timestamp").timestampToUnixMicros()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the number of microseconds since epoch. |

### timestampToUnixMicros

```
public static final @NonNull Expression timestampToUnixMicros(@NonNull 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).

```
// Convert the 'timestamp' field to microseconds since epoch.
timestampToUnixMicros(field("timestamp"))
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The expression representing the timestamp. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the number of microseconds since epoch. |

### timestampToUnixMicros

```
public static final @NonNull Expression timestampToUnixMicros(@NonNull 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).

```
// Convert the 'timestamp' field to microseconds since epoch.
timestampToUnixMicros("timestamp")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field that contains the timestamp. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the number of microseconds since epoch. |

### timestampToUnixMillis

```
public final @NonNull 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).

```
// Convert the 'timestamp' field to milliseconds since epoch.
field("timestamp").timestampToUnixMillis()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the number of milliseconds since epoch. |

### timestampToUnixMillis

```
public static final @NonNull Expression timestampToUnixMillis(@NonNull 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).

```
// Convert the 'timestamp' field to milliseconds since epoch.
timestampToUnixMillis(field("timestamp"))
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The expression representing the timestamp. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the number of milliseconds since epoch. |

### timestampToUnixMillis

```
public static final @NonNull Expression timestampToUnixMillis(@NonNull 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).

```
// Convert the 'timestamp' field to milliseconds since epoch.
timestampToUnixMillis("timestamp")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field that contains the timestamp. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the number of milliseconds since epoch. |

### timestampToUnixSeconds

```
public final @NonNull 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).

```
// Convert the 'timestamp' field to seconds since epoch.
field("timestamp").timestampToUnixSeconds()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the number of seconds since epoch. |

### timestampToUnixSeconds

```
public static final @NonNull Expression timestampToUnixSeconds(@NonNull 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).

```
// Convert the 'timestamp' field to seconds since epoch.
timestampToUnixSeconds(field("timestamp"))
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The expression representing the timestamp. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the number of seconds since epoch. |

### timestampToUnixSeconds

```
public static final @NonNull Expression timestampToUnixSeconds(@NonNull 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).

```
// Convert the 'timestamp' field to seconds since epoch.
timestampToUnixSeconds("timestamp")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field that contains the timestamp. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the number of seconds since epoch. |

### timestampTruncate

```
public final @NonNull Expression timestampTruncate(@NonNull Expression granularity)
```

Creates an expression that truncates this timestamp expression to a specified granularity.

```
// Truncate the 'createdAt' timestamp to the beginning of the day.
field("createdAt").timestampTruncate(field("granularity"))
```

| Parameters |
|---|---|
| `@NonNull Expression granularity` | The 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 |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncate

```
public final @NonNull Expression timestampTruncate(@NonNull String granularity)
```

Creates an expression that truncates this timestamp expression to a specified granularity.

```
// Truncate the 'createdAt' timestamp to the beginning of the day.
field("createdAt").timestampTruncate("day")
```

| Parameters |
|---|---|
| `@NonNull String granularity` | The 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 |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncate

```
public static final @NonNull Expression timestampTruncate(
    @NonNull String fieldName,
    @NonNull Expression granularity
)
```

Creates an expression that truncates a timestamp to a specified granularity.

```
// Truncate the 'createdAt' timestamp to the beginning of the day.
timestampTruncate("createdAt", field("granularity"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the timestamp. |
| `@NonNull Expression granularity` | The 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 |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncate

```
public static final @NonNull Expression timestampTruncate(@NonNull String fieldName, @NonNull String granularity)
```

Creates an expression that truncates a timestamp to a specified granularity.

```
// Truncate the 'createdAt' timestamp to the beginning of the day.
timestampTruncate("createdAt", "day")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the timestamp. |
| `@NonNull String granularity` | The 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 |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncate

```
public static final @NonNull Expression timestampTruncate(
    @NonNull Expression timestamp,
    @NonNull Expression granularity
)
```

Creates an expression that truncates a timestamp to a specified granularity.

```
// Truncate the 'createdAt' timestamp to the beginning of the day.
timestampTruncate(field("createdAt"), field("granularity"))
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The timestamp expression. |
| `@NonNull Expression granularity` | The 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 |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncate

```
public static final @NonNull Expression timestampTruncate(
    @NonNull Expression timestamp,
    @NonNull String granularity
)
```

Creates an expression that truncates a timestamp to a specified granularity.

```
// Truncate the 'createdAt' timestamp to the beginning of the day.
timestampTruncate(field("createdAt"), "day")
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The timestamp expression. |
| `@NonNull String granularity` | The 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 |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncateWithTimezone

```
public final @NonNull Expression timestampTruncateWithTimezone(
    @NonNull Expression granularity,
    @NonNull Expression timezone
)
```

Creates an expression that truncates this timestamp expression to a specified granularity in a given timezone.

```
// Truncate the 'createdAt' timestamp to the beginning of the day in timezone specified by the
// 'tz' field.
field("createdAt").timestampTruncateWithTimezone(field("granularity"), field("tz"))
```

| Parameters |
|---|---|
| `@NonNull Expression granularity` | The 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". |
| `@NonNull Expression timezone` | The timezone expression to use for truncation. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncateWithTimezone

```
public final @NonNull Expression timestampTruncateWithTimezone(
    @NonNull Expression granularity,
    @NonNull String timezone
)
```

Creates an expression that truncates this timestamp expression to a specified granularity in a given timezone.

```
// Truncate the 'createdAt' timestamp to the beginning of the day in "America/Los_Angeles"
// timezone.
field("createdAt").timestampTruncateWithTimezone(field("granularity"), "America/Los_Angeles")
```

| Parameters |
|---|---|
| `@NonNull Expression granularity` | The 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". |
| `@NonNull String timezone` | The timezone to use for truncation. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncateWithTimezone

```
public final @NonNull Expression timestampTruncateWithTimezone(
    @NonNull String granularity,
    @NonNull Expression timezone
)
```

Creates an expression that truncates this timestamp expression to a specified granularity in a given timezone.

```
// Truncate the 'createdAt' timestamp to the beginning of the day in timezone specified by the
// 'tz' field.
field("createdAt").timestampTruncateWithTimezone("day", field("tz"))
```

| Parameters |
|---|---|
| `@NonNull String granularity` | The 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". |
| `@NonNull Expression timezone` | The timezone expression to use for truncation. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncateWithTimezone

```
public final @NonNull Expression timestampTruncateWithTimezone(
    @NonNull String granularity,
    @NonNull String timezone
)
```

Creates an expression that truncates this timestamp expression to a specified granularity in a given timezone.

```
// Truncate the 'createdAt' timestamp to the beginning of the day in "America/Los_Angeles"
// timezone.
field("createdAt").timestampTruncateWithTimezone("day", "America/Los_Angeles")
```

| Parameters |
|---|---|
| `@NonNull String granularity` | The 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". |
| `@NonNull String timezone` | The timezone to use for truncation. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncateWithTimezone

```
public static final @NonNull Expression timestampTruncateWithTimezone(
    @NonNull String fieldName,
    @NonNull Expression granularity,
    @NonNull Expression timezone
)
```

Creates an expression that truncates a timestamp to a specified granularity in a given timezone.

```
// Truncate the 'createdAt' timestamp to the beginning of the day in timezone specified by
// the 'tz' field.
timestampTruncateWithTimezone("createdAt", field("granularity"), field("tz"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the timestamp. |
| `@NonNull Expression granularity` | The 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". |
| `@NonNull Expression timezone` | The timezone expression to use for truncation. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncateWithTimezone

```
public static final @NonNull Expression timestampTruncateWithTimezone(
    @NonNull String fieldName,
    @NonNull Expression granularity,
    @NonNull String timezone
)
```

Creates an expression that truncates a timestamp to a specified granularity in a given timezone.

```
// Truncate the 'createdAt' timestamp to the beginning of the day in "America/Los_Angeles"
// timezone.
timestampTruncateWithTimezone("createdAt", field("granularity"), "America/Los_Angeles")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the timestamp. |
| `@NonNull Expression granularity` | The 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". |
| `@NonNull String timezone` | The timezone to use for truncation. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncateWithTimezone

```
public static final @NonNull Expression timestampTruncateWithTimezone(
    @NonNull String fieldName,
    @NonNull String granularity,
    @NonNull Expression timezone
)
```

Creates an expression that truncates a timestamp to a specified granularity in a given timezone.

```
// Truncate the 'createdAt' timestamp to the beginning of the day in timezone specified by
// the 'tz' field.
timestampTruncateWithTimezone("createdAt", "day", field("tz"))
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the timestamp. |
| `@NonNull String granularity` | The 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". |
| `@NonNull Expression timezone` | The timezone expression to use for truncation. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncateWithTimezone

```
public static final @NonNull Expression timestampTruncateWithTimezone(
    @NonNull String fieldName,
    @NonNull String granularity,
    @NonNull String timezone
)
```

Creates an expression that truncates a timestamp to a specified granularity in a given timezone.

```
// Truncate the 'createdAt' timestamp to the beginning of the day in "America/Los_Angeles"
// timezone.
timestampTruncateWithTimezone("createdAt", "day", "America/Los_Angeles")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the timestamp. |
| `@NonNull String granularity` | The 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". |
| `@NonNull String timezone` | The timezone to use for truncation. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncateWithTimezone

```
public static final @NonNull Expression timestampTruncateWithTimezone(
    @NonNull Expression timestamp,
    @NonNull Expression granularity,
    @NonNull Expression timezone
)
```

Creates an expression that truncates a timestamp to a specified granularity in a given timezone.

```
// Truncate the 'createdAt' timestamp to the beginning of the day in timezone specified by
// the 'tz' field.
timestampTruncateWithTimezone(field("createdAt"), field("granularity"), field("tz"))
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The timestamp expression. |
| `@NonNull Expression granularity` | The 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". |
| `@NonNull Expression timezone` | The timezone expression to use for truncation. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncateWithTimezone

```
public static final @NonNull Expression timestampTruncateWithTimezone(
    @NonNull Expression timestamp,
    @NonNull Expression granularity,
    @NonNull String timezone
)
```

Creates an expression that truncates a timestamp to a specified granularity in a given timezone.

```
// Truncate the 'createdAt' timestamp to the beginning of the day in "America/Los_Angeles"
// timezone.
timestampTruncateWithTimezone(field("createdAt"), field("granularity"), "America/Los_Angeles")
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The timestamp expression. |
| `@NonNull Expression granularity` | The 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". |
| `@NonNull String timezone` | The timezone to use for truncation. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncateWithTimezone

```
public static final @NonNull Expression timestampTruncateWithTimezone(
    @NonNull Expression timestamp,
    @NonNull String granularity,
    @NonNull Expression timezone
)
```

Creates an expression that truncates a timestamp to a specified granularity in a given timezone.

```
// Truncate the 'createdAt' timestamp to the beginning of the day in timezone specified by
// the 'tz' field.
timestampTruncateWithTimezone(field("createdAt"), "day", field("tz"))
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The timestamp expression. |
| `@NonNull String granularity` | The 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". |
| `@NonNull Expression timezone` | The timezone expression to use for truncation. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### timestampTruncateWithTimezone

```
public static final @NonNull Expression timestampTruncateWithTimezone(
    @NonNull Expression timestamp,
    @NonNull String granularity,
    @NonNull String timezone
)
```

Creates an expression that truncates a timestamp to a specified granularity in a given timezone.

```
// Truncate the 'createdAt' timestamp to the beginning of the day in "America/Los_Angeles"
// timezone.
timestampTruncateWithTimezone(field("createdAt"), "day", "America/Los_Angeles")
```

| Parameters |
|---|---|
| `@NonNull Expression timestamp` | The timestamp expression. |
| `@NonNull String granularity` | The 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". |
| `@NonNull String timezone` | The timezone to use for truncation. Valid values are from the TZ database (for example, "America/Los_Angeles") or in the format "Etc/GMT-1". |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncated timestamp. |

### toLower

```
public final @NonNull Expression toLower()
```

Creates an expression that converts this string expression to lowercase.

```
// Convert the 'name' field to lowercase
field("name").toLower()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the lowercase string. |

### toLower

```
public static final @NonNull Expression toLower(@NonNull String fieldName)
```

Creates an expression that converts a string field to lowercase.

```
// Convert the 'name' field to lowercase
toLower("name")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to convert to lowercase. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the lowercase string. |

### toLower

```
public static final @NonNull Expression toLower(@NonNull Expression stringExpression)
```

Creates an expression that converts a string expression to lowercase.

```
// Convert the 'name' field to lowercase
toLower(field("name"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to convert to lowercase. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the lowercase string. |

### toUpper

```
public final @NonNull Expression toUpper()
```

Creates an expression that converts this string expression to uppercase.

```
// Convert the 'title' field to uppercase
field("title").toUpper()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the uppercase string. |

### toUpper

```
public static final @NonNull Expression toUpper(@NonNull String fieldName)
```

Creates an expression that converts a string field to uppercase.

```
// Convert the 'title' field to uppercase
toUpper("title")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to convert to uppercase. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the uppercase string. |

### toUpper

```
public static final @NonNull Expression toUpper(@NonNull Expression stringExpression)
```

Creates an expression that converts a string expression to uppercase.

```
// Convert the 'title' field to uppercase
toUpper(field("title"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to convert to uppercase. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the uppercase string. |

### trim

```
public final @NonNull Expression trim()
```

Creates an expression that removes leading and trailing whitespace from this string expression.

```
// Trim whitespace from the 'userInput' field
field("userInput").trim()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the trimmed string. |

### trim

```
public static final @NonNull Expression trim(@NonNull String fieldName)
```

Creates an expression that removes leading and trailing whitespace from a string field.

```
// Trim whitespace from the 'userInput' field
trim("userInput")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to trim. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the trimmed string. |

### trim

```
public static final @NonNull Expression trim(@NonNull Expression stringExpression)
```

Creates an expression that removes leading and trailing whitespace from a string expression.

```
// Trim whitespace from the 'userInput' field
trim(field("userInput"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to trim. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the trimmed string. |

### trimValue

```
public final @NonNull Expression trimValue(@NonNull Expression valueToTrim)
```

Creates an expression that removes a set of leading and trailing values from this expression. The accepted types are string and blob.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim specified characters from the 'userInput' field
field("userInput").trimValue(field("trimChars"))
```

| Parameters |
|---|---|
| `@NonNull Expression valueToTrim` | The expression representing the set of values to trim from the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the trimmed string. |

### trimValue

```
public final @NonNull Expression trimValue(@NonNull String valueToTrim)
```

Creates an expression that removes a set of leading and trailing values from this string expression.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim all '_' and '-' characters from the 'userInput' field
field("userInput").trimValue("-_")
```

| Parameters |
|---|---|
| `@NonNull String valueToTrim` | The set of values to trim from the string. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the trimmed string. |

### trimValue

```
public static final @NonNull Expression trimValue(@NonNull String fieldName, @NonNull String valueToTrim)
```

Creates an expression that removes a set of leading and trailing values from a string field.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim all '-', and '_' characters from the beginning and the end of 'userInput' field
trimValue("userInput", "-_")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the string to trim. |
| `@NonNull String valueToTrim` | This parameter is treated as a set of characters or bytes that will be matched against the input from both ends. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the trimmed string. |

### trimValue

```
public static final @NonNull Expression trimValue(
    @NonNull Expression stringExpression,
    @NonNull Expression valueToTrim
)
```

Creates an expression that removes a set of leading and trailing values from an expression.

Note: The values to trim are treated as a **set**, not a substring.

```
// Trim specified characters from the 'userInput' field
trimValue(field("userInput"), field("valueToTrim"))
```

| Parameters |
|---|---|
| `@NonNull Expression stringExpression` | The expression representing the string to trim. |
| `@NonNull Expression valueToTrim` | The expression evaluated to either a string or a blob. This parameter is treated as a set of characters or bytes that will be matched against the input from both ends. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the trimmed string or bytes. |

### trunc

```
public final @NonNull Expression trunc()
```

Creates an expression that truncates this numeric expression to an integer.

```
// Truncate the value of the 'rating' field.
field("rating").trunc()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncate operation. |

### trunc

```
public static final @NonNull Expression trunc(@NonNull Expression numericExpr)
```

Creates an expression that truncates `numericExpr` to an integer.

```
// Truncate the value of the 'rating' field.
trunc(field("rating"))
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncate operation. |

### trunc

```
public static final @NonNull Expression trunc(@NonNull String numericField)
```

Creates an expression that truncates `numericField` to an integer.

```
// Truncate the value of the 'rating' field.
trunc("rating")
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncate operation. |

### truncToPrecision

```
public final @NonNull Expression truncToPrecision(@NonNull Expression decimalPlace)
```

Creates an expression that truncates this numeric expression to `decimalPlace` decimal places if `decimalPlace` is positive, truncates digits to the left of the decimal point if `decimalPlace` is negative.

```
// Truncate the value of the 'rating' field to the number of decimal places specified in the
// 'precision' field.
field("rating").truncToPrecision(field("precision"))
```

| Parameters |
|---|---|
| `@NonNull Expression decimalPlace` | The number of decimal places to truncate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncate operation. |

### truncToPrecision

```
public final @NonNull Expression truncToPrecision(int decimalPlace)
```

Creates an expression that truncates this numeric expression to `decimalPlace` decimal places if `decimalPlace` is positive, truncates digits to the left of the decimal point if `decimalPlace` is negative.

```
// Truncate the value of the 'rating' field to 2 decimal places.
field("rating").truncToPrecision(2)
```

| Parameters |
|---|---|
| `int decimalPlace` | The number of decimal places to truncate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncate operation. |

### truncToPrecision

```
public static final @NonNull Expression truncToPrecision(
    @NonNull Expression numericExpr,
    @NonNull Expression decimalPlace
)
```

Creates an expression that truncates `numericExpr` to `decimalPlace` decimal places if `decimalPlace` is positive, truncates digits to the left of the decimal point if `decimalPlace` is negative.

```
// Truncate the value of the 'rating' field to the number of decimal places specified in the
// 'precision' field.
truncToPrecision(field("rating"), field("precision"))
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |
| `@NonNull Expression decimalPlace` | The number of decimal places to truncate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncate operation. |

### truncToPrecision

```
public static final @NonNull Expression truncToPrecision(@NonNull Expression numericExpr, int decimalPlace)
```

Creates an expression that truncates `numericExpr` to `decimalPlace` decimal places if `decimalPlace` is positive, truncates digits to the left of the decimal point if `decimalPlace` is negative.

```
// Truncate the value of the 'rating' field to 2 decimal places.
truncToPrecision(field("rating"), 2)
```

| Parameters |
|---|---|
| `@NonNull Expression numericExpr` | An expression that returns number when evaluated. |
| `int decimalPlace` | The number of decimal places to truncate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncate operation. |

### truncToPrecision

```
public static final @NonNull Expression truncToPrecision(
    @NonNull String numericField,
    @NonNull Expression decimalPlace
)
```

Creates an expression that truncates `numericField` to `decimalPlace` decimal places if `decimalPlace` is positive, truncates digits to the left of the decimal point if `decimalPlace` is negative.

```
// Truncate the value of the 'rating' field to the number of decimal places specified in the
// 'precision' field.
truncToPrecision("rating", field("precision"))
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |
| `@NonNull Expression decimalPlace` | The number of decimal places to truncate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncate operation. |

### truncToPrecision

```
public static final @NonNull Expression truncToPrecision(@NonNull String numericField, int decimalPlace)
```

Creates an expression that truncates `numericField` to `decimalPlace` decimal places if `decimalPlace` is positive, truncates digits to the left of the decimal point if `decimalPlace` is negative.

```
// Truncate the value of the 'rating' field to 2 decimal places.
truncToPrecision("rating", 2)
```

| Parameters |
|---|---|
| `@NonNull String numericField` | Name of field that returns number when evaluated. |
| `int decimalPlace` | The number of decimal places to truncate. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the truncate operation. |

### type

```
public final @NonNull Expression type()
```

Creates an expression that returns a string indicating the type of the value this expression evaluates to.

```
// Get the type of the 'value' field.
field("value").type()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the type operation. |

### type

```
public static final @NonNull Expression type(@NonNull Expression expr)
```

Creates an expression that returns a string indicating the type of the value this expression evaluates to.

```
// Get the type of the 'value' field.
type(field("value"))
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The expression to get the type of. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the type operation. |

### type

```
public static final @NonNull Expression type(@NonNull String fieldName)
```

Creates an expression that returns a string indicating the type of the value this field evaluates to.

```
// Get the type of the 'field' field.
type("field")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field to get the type of. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the type operation. |

### unixMicrosToTimestamp

```
public final @NonNull 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.

```
// Interpret the 'microseconds' field as microseconds since epoch.
field("microseconds").unixMicrosToTimestamp()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the timestamp. |

### unixMicrosToTimestamp

```
public static final @NonNull Expression unixMicrosToTimestamp(@NonNull Expression expr)
```

Creates an expression that interprets an expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.

```
// Interpret the 'microseconds' field as microseconds since epoch.
unixMicrosToTimestamp(field("microseconds"))
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The expression representing the number of microseconds since epoch. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the timestamp. |

### unixMicrosToTimestamp

```
public static final @NonNull Expression unixMicrosToTimestamp(@NonNull 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.

```
// Interpret the 'microseconds' field as microseconds since epoch.
unixMicrosToTimestamp("microseconds")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the number of microseconds since epoch. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the timestamp. |

### unixMillisToTimestamp

```
public final @NonNull 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.

```
// Interpret the 'milliseconds' field as milliseconds since epoch.
field("milliseconds").unixMillisToTimestamp()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the timestamp. |

### unixMillisToTimestamp

```
public static final @NonNull Expression unixMillisToTimestamp(@NonNull 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.

```
// Interpret the 'milliseconds' field as milliseconds since epoch.
unixMillisToTimestamp(field("milliseconds"))
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The expression representing the number of milliseconds since epoch. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the timestamp. |

### unixMillisToTimestamp

```
public static final @NonNull Expression unixMillisToTimestamp(@NonNull 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.

```
// Interpret the 'milliseconds' field as milliseconds since epoch.
unixMillisToTimestamp("milliseconds")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the number of milliseconds since epoch. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the timestamp. |

### unixSecondsToTimestamp

```
public final @NonNull 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.

```
// Interpret the 'seconds' field as seconds since epoch.
field("seconds").unixSecondsToTimestamp()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the timestamp. |

### unixSecondsToTimestamp

```
public static final @NonNull Expression unixSecondsToTimestamp(@NonNull 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.

```
// Interpret the 'seconds' field as seconds since epoch.
unixSecondsToTimestamp(field("seconds"))
```

| Parameters |
|---|---|
| `@NonNull Expression expr` | The expression representing the number of seconds since epoch. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the timestamp. |

### unixSecondsToTimestamp

```
public static final @NonNull Expression unixSecondsToTimestamp(@NonNull 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.

```
// Interpret the 'seconds' field as seconds since epoch.
unixSecondsToTimestamp("seconds")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the number of seconds since epoch. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the timestamp. |

### variable

```
public static final @NonNull Expression variable(@NonNull String name)
```

Creates an expression that retrieves the value of a variable bound via `Pipeline.define`.

Example:

```
firestore.pipeline().collection("products")
    .define(
        multiply(field("price"), 0.9).as("discountedPrice"),
        add(field("stock"), 10).as("newStock")
    )
    .where(lessThan(variable("discountedPrice"), 100))
    .select(field("name"), variable("newStock"));
```

| Parameters |
|---|---|
| `@NonNull String name` | The name of the variable to retrieve. |

| Returns |
|---|---|
| `@NonNull Expression` | An `Expression` representing the variable's value. |

### vector

```
public static final @NonNull Expression vector(@NonNull double[] vector)
```

Create a vector constant for a `DoubleArray` value.

```
// Create a vector constant from a DoubleArray
vector(doubleArrayOf(1.0, 2.0, 3.0))
```

| Parameters |
|---|---|
| `@NonNull double[] vector` | The `DoubleArray` value. |

| Returns |
|---|---|
| `@NonNull Expression` | A `Expression` constant instance. |

### vector

```
public static final @NonNull Expression vector(@NonNull VectorValue vector)
```

Create a vector constant for a `VectorValue` value.

```
// Create a vector constant from a VectorValue
vector(VectorValue(listOf(1.0, 2.0, 3.0)))
```

| Parameters |
|---|---|
| `@NonNull VectorValue vector` | The `VectorValue` value. |

| Returns |
|---|---|
| `@NonNull Expression` | A `Expression` constant instance. |

### vectorLength

```
public final @NonNull Expression vectorLength()
```

Creates an expression that calculates the length (dimension) of a Firestore Vector.

```
// Get the vector length (dimension) of the field 'embedding'.
field("embedding").vectorLength()
```

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the length (dimension) of the vector. |

### vectorLength

```
public static final @NonNull Expression vectorLength(@NonNull String fieldName)
```

Creates an expression that calculates the length (dimension) of a Firestore Vector.

```
// Get the vector length (dimension) of the field 'embedding'.
vectorLength("embedding")
```

| Parameters |
|---|---|
| `@NonNull String fieldName` | The name of the field containing the Firestore Vector. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the length (dimension) of the vector. |

### vectorLength

```
public static final @NonNull Expression vectorLength(@NonNull Expression vectorExpression)
```

Creates an expression that calculates the length (dimension) of a Firestore Vector.

```
// Get the vector length (dimension) of the field 'embedding'.
vectorLength(field("embedding"))
```

| Parameters |
|---|---|
| `@NonNull Expression vectorExpression` | The expression representing the Firestore Vector. |

| Returns |
|---|---|
| `@NonNull Expression` | A new `Expression` representing the length (dimension) of the vector. |

### xor

```
public static final @NonNull BooleanExpression xor(
    @NonNull BooleanExpression condition,
    @NonNull BooleanExpression conditions
)
```

Creates an expression that performs a logical 'XOR' operation.

```
// Check if either 'a' is true or 'b' is true, but not both
xor(field("a"), field("b"))
```

| Parameters |
|---|---|
| `@NonNull BooleanExpression condition` | The first `BooleanExpression`. |
| `@NonNull BooleanExpression conditions` | Additional `BooleanExpression`s. |

| Returns |
|---|---|
| `@NonNull BooleanExpression` | A new `BooleanExpression` representing the logical 'XOR' operation. |