Field

@Beta
public final class Field extends Selectable


Represents a reference to a field in a Firestore document.

Field references are used to access document field values in expressions and to specify fields for sorting, filtering, and projecting data in Firestore pipelines.

You can create a Field instance using the static Expression.field method:

Summary

Nested types

public static class Field.Companion

Public methods

boolean
equals(Object other)
int

Inherited methods

From com.google.firebase.firestore.pipeline.Expression
final @NonNull Expression
abs()

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

final @NonNull Expression

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.

@NonNull Selectable

Assigns an alias to this expression.

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.

final @NonNull BooleanExpression

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

final @NonNull BooleanExpression

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

final @NonNull BooleanExpression

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

final @NonNull BooleanExpression

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

final @NonNull BooleanExpression

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

final @NonNull BooleanExpression

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

final @NonNull Expression

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.

final @NonNull Expression

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

final @NonNull Expression

Reverses the order of elements in the array.

final @NonNull Expression

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

final @NonNull BooleanExpression

Casts the expression to a BooleanExpression.

final @NonNull Ordering

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

final @NonNull AggregateFunction

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

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

final @NonNull Expression
bitLeftShift(int number)

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

final @NonNull Expression

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

final @NonNull Expression

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

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.

final @NonNull Expression
bitRightShift(int number)

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

final @NonNull Expression

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

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

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

final @NonNull Expression

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

final @NonNull Expression

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

final @NonNull Expression

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

final @NonNull Expression

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

final @NonNull Expression

Creates an expression that returns the collection ID from this path expression.

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.

final @NonNull Expression
cosineDistance(@NonNull double[] vector)

Calculates the Cosine distance between this vector expression and a vector literal.

final @NonNull Expression

Calculates the Cosine distance between this and another vector expressions.

final @NonNull Expression

Calculates the Cosine distance between this vector expression and a vector literal.

final @NonNull AggregateFunction

Creates an aggregation that counts the number of stage inputs with valid evaluations of the this expression.

final @NonNull AggregateFunction

Creates an aggregation that counts the number of distinct values of an expression across multiple stage inputs.

final @NonNull Ordering

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

final @NonNull Expression

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.

final @NonNull Expression

Creates an expression that returns the document ID from this path expression.

final @NonNull Expression
dotProduct(@NonNull double[] vector)

Calculates the dot product distance between this vector expression and a vector literal.

final @NonNull Expression

Calculates the dot product distance between this and another vector expression.

final @NonNull Expression

Calculates the dot product distance between this vector expression and a vector literal.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression ends with a given suffix.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression ends with a given suffix.

final @NonNull BooleanExpression

Creates an expression that checks if this and other expression are equal.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is equal to a value.

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

Creates an expression that checks if this expression, when evaluated, 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

Calculates the Euclidean distance between this and another vector expression.

final @NonNull Expression

Calculates the Euclidean distance between this vector expression and a vector literal.

final @NonNull BooleanExpression

Creates an expression that checks if this expression evaluates to a name of the field that exists.

final @NonNull Expression
exp()

Creates an expression that returns Euler's number e raised to the power of this expression.

final @NonNull Expression

Creates an expression that returns the largest integer that is not greater than this numeric expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is greater than the other expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is greater than a value.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is greater than or equal to the other expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is greater than or equal to a value.

final @NonNull Expression

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.

final @NonNull Expression

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.

final @NonNull BooleanExpression

Creates an expression that returns true if the result of this expression is absent.

final @NonNull BooleanExpression

Creates an expression that checks if this expression produces an error.

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.

final @NonNull Expression

Creates an expression that calculates the length of a string, array, map, vector, or blob expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is less than the other expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is less than a value.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is less than or equal to the other expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is less than or equal to a value.

final @NonNull BooleanExpression

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.

final @NonNull Expression
ln()

Creates an expression that returns the natural logarithm of this numeric expression.

final @NonNull Expression

Creates an expression that returns the base-10 logarithm of this numeric expression.

final @NonNull Expression

Creates an expression that returns the largest value between multiple input expressions or literal values.

final @NonNull Expression

Creates an expression that returns the largest value between multiple input expressions or literal values.

final @NonNull Expression

Creates an expression that returns the smallest value between multiple input expressions or literal values.

final @NonNull Expression

Creates an expression that returns the smallest value between multiple input expressions or literal values.

final @NonNull Expression

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.

final @NonNull Expression
mapMerge(@NonNull Expression mapExpr, @NonNull Expression otherMaps)

Creates an expression that merges multiple maps into a single map.

final @NonNull Expression

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.

final @NonNull AggregateFunction

Creates an aggregation that finds the maximum value of this expression across multiple stage inputs.

final @NonNull AggregateFunction

Creates an aggregation that finds the minimum value of this expression across multiple stage inputs.

final @NonNull Expression

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.

final @NonNull Expression

Creates an expression that multiplies this numeric expression with another numeric expression.

final @NonNull Expression

Creates an expression that multiplies this numeric expression with a constant.

final @NonNull BooleanExpression

Creates an expression that checks if this expressions is not equal to the other expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is not equal to a value.

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

Creates an expression that checks if this expression, when evaluated, is not equal to all the provided values.

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.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression contains a specified regular expression as a substring.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression contains a specified regular expression as a substring.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression matches a specified regular expression.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression matches a specified regular expression.

final @NonNull Expression

Creates an expression that reverses this string expression.

final @NonNull Expression

Creates an expression that rounds this numeric expression to nearest integer.

final @NonNull Expression

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.

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.

final @NonNull Expression

Creates an expression that returns the square root of this numeric expression.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression starts with a given prefix.

final @NonNull BooleanExpression

Creates an expression that checks if this 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

Creates an expression that concatenates string expressions and string constants together.

final @NonNull Expression

Creates an expression that concatenates this string expression with string constants.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression contains a specified substring.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression contains a specified substring.

final @NonNull Expression

Creates an expression that performs a reverse operation on this string expression.

final @NonNull Expression

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.

final @NonNull Expression

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.

final @NonNull AggregateFunction
sum()

Creates an aggregation that calculates the sum of this numeric expression across multiple stage inputs.

final @NonNull Expression

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.

final @NonNull Expression

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.

final @NonNull Expression

Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC).

final @NonNull Expression

Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).

final @NonNull Expression

Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC).

final @NonNull Expression

Creates an expression that truncates this timestamp expression to a specified granularity.

final @NonNull Expression

Creates an expression that truncates this timestamp expression to a specified granularity.

final @NonNull Expression

Creates an expression that converts this string expression to lowercase.

final @NonNull Expression

Creates an expression that converts this string expression to uppercase.

final @NonNull Expression

Creates an expression that removes leading and trailing whitespace from this string expression.

final @NonNull Expression

Creates an expression that removes leading and trailing value from this expression.

final @NonNull Expression
trimValue(@NonNull String valueToTrim)

Creates an expression that removes leading and trailing characters from this string expression.

final @NonNull Expression

Creates an expression that returns a string indicating the type of the value this expression evaluates to.

final @NonNull Expression

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.

final @NonNull Expression

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.

final @NonNull Expression

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.

final @NonNull Expression

Creates an expression that calculates the length (dimension) of a Firestore Vector.

Public methods

equals

public boolean equals(Object other)

hashCode

public int hashCode()