Field

@Beta
class Field : 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

Public functions

open operator Boolean
equals(other: Any?)
open Int

Inherited functions

From com.google.firebase.firestore.pipeline.Expression
Expression
abs()

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

Expression
add(second: Expression)

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

Expression
add(second: Number)

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

open Selectable
alias(alias: String)

Assigns an alias to this expression.

Expression
arrayConcat(secondArray: Any, vararg otherArrays: Any)

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

Expression
arrayConcat(secondArray: Expression, vararg otherArrays: Any)

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

BooleanExpression
arrayContains(element: Any)

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

BooleanExpression

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

BooleanExpression
arrayContainsAll(arrayExpression: Expression)

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

BooleanExpression

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

BooleanExpression
arrayContainsAny(arrayExpression: Expression)

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

BooleanExpression

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

Expression

Creates an expression that indexes into an array from the beginning or end and return the element.

Expression
arrayGet(offset: Int)

Creates an expression that indexes into an array from the beginning or end and return the element.

Expression

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

Expression

Reverses the order of elements in the array.

Expression

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

BooleanExpression

Casts the expression to a BooleanExpression.

Ordering

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

AggregateFunction

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

Expression
bitAnd(bitsOther: ByteArray)

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

Expression
bitAnd(bitsOther: Expression)

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

Expression
bitLeftShift(number: Int)

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

Expression
bitLeftShift(numberExpr: Expression)

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

Expression

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

Expression
bitOr(bitsOther: ByteArray)

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

Expression
bitOr(bitsOther: Expression)

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

Expression
bitRightShift(number: Int)

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

Expression

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

Expression
bitXor(bitsOther: ByteArray)

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

Expression
bitXor(bitsOther: Expression)

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

Expression

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

Expression

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

Expression

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

Expression

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

Expression
concat(second: Any, vararg others: Any)

Creates an expression that concatenates this expression's value with others.

Expression
concat(second: Expression, vararg others: Any)

Creates an expression that concatenates this expression's value with others.

Expression

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

Expression

Calculates the Cosine distance between this and another vector expressions.

Expression

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

AggregateFunction

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

AggregateFunction

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

Ordering

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

Expression
divide(divisor: Expression)

Creates an expression that divides this numeric expression by another numeric expression.

Expression
divide(divisor: Number)

Creates an expression that divides this numeric expression by a constant.

Expression

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

Expression

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

Expression

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

Expression

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

BooleanExpression

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

BooleanExpression
endsWith(suffix: String)

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

BooleanExpression
equal(other: Expression)

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

BooleanExpression
equal(value: Any)

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

BooleanExpression
equalAny(arrayExpression: Expression)

Creates an expression that checks if this expression, when evaluated, is equal to any of the elements of arrayExpression.

BooleanExpression
equalAny(values: List<Any>)

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

Expression

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

Expression

Calculates the Euclidean distance between this and another vector expression.

Expression

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

BooleanExpression

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

Expression
exp()

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

Expression

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

BooleanExpression

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

BooleanExpression
greaterThan(value: Any)

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

BooleanExpression

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

BooleanExpression

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

Expression
ifAbsent(elseExpr: Expression)

Creates an expression that returns the elseExpr argument if this expression is absent, else return the result of this expression.

Expression
ifAbsent(elseValue: Any)

Creates an expression that returns the elseValue argument if this expression is absent, else return the result of this expression.

Expression
ifError(catchExpr: Expression)

Creates an expression that returns the catchExpr argument if there is an error, else return the result of this expression.

Expression
ifError(catchValue: Any)

Creates an expression that returns the catchValue argument if there is an error, else return the result of this expression.

BooleanExpression

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

BooleanExpression

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

Expression
join(delimiter: String)

Creates an expression that joins the elements of an array into a string.

Expression
join(delimiterExpression: Expression)

Creates an expression that joins the elements of an array into a string.

Expression

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

BooleanExpression

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

BooleanExpression
lessThan(value: Any)

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

BooleanExpression

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

BooleanExpression

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

BooleanExpression
like(pattern: Expression)

Creates an expression that performs a case-sensitive wildcard string comparison.

BooleanExpression
like(pattern: String)

Creates an expression that performs a case-sensitive wildcard string comparison.

Expression
ln()

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

Expression

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

Expression
logicalMaximum(vararg others: Any)

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

Expression
logicalMaximum(vararg others: Expression)

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

Expression
logicalMinimum(vararg others: Any)

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

Expression
logicalMinimum(vararg others: Expression)

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

Expression
mapGet(key: String)

Accesses a map (object) value using the provided key.

Expression
mapGet(keyExpression: Expression)

Accesses a map (object) value using the provided keyExpression.

Expression
mapMerge(mapExpr: Expression, vararg otherMaps: Expression)

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

Expression

Creates an expression that removes a key from this map expression.

Expression
mapRemove(keyExpression: Expression)

Creates an expression that removes a key from this map expression.

AggregateFunction

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

AggregateFunction

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

Expression
mod(divisor: Expression)

Creates an expression that calculates the modulo (remainder) of dividing this numeric expressions by another numeric expression.

Expression
mod(divisor: Number)

Creates an expression that calculates the modulo (remainder) of dividing this numeric expressions by a constant.

Expression

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

Expression
multiply(second: Number)

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

BooleanExpression

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

BooleanExpression
notEqual(value: Any)

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

BooleanExpression
notEqualAny(arrayExpression: Expression)

Creates an expression that checks if this expression, when evaluated, is not equal to all the elements of arrayExpression.

BooleanExpression
notEqualAny(values: List<Any>)

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

Expression
pow(exponent: Expression)

Creates an expression that returns this numeric expression raised to the power of the exponent.

Expression
pow(exponent: Number)

Creates an expression that returns this numeric expression raised to the power of the exponent.

BooleanExpression

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

BooleanExpression

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

BooleanExpression

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

BooleanExpression
regexMatch(pattern: String)

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

Expression

Creates an expression that reverses this string expression.

Expression

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

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.

Expression
roundToPrecision(decimalPlace: Int)

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.

Expression
split(delimiter: Blob)

Creates an expression that splits this blob expression by a blob delimiter.

Expression
split(delimiter: Expression)

Creates an expression that splits this string or blob expression by a delimiter.

Expression
split(delimiter: String)

Creates an expression that splits this string or blob expression by a string delimiter.

Expression

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

BooleanExpression

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

BooleanExpression
startsWith(prefix: String)

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

Expression
stringConcat(vararg stringExpressions: Expression)

Creates an expression that concatenates string expressions together.

Expression
stringConcat(vararg strings: Any)

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

Expression
stringConcat(vararg strings: String)

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

BooleanExpression

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

BooleanExpression
stringContains(substring: String)

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

Expression

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

Expression
substring(start: Expression, length: Expression)

Creates an expression that returns a substring of the given string.

Expression
substring(start: Int, length: Int)

Creates an expression that returns a substring of the given string.

Expression
subtract(subtrahend: Expression)

Creates an expression that subtracts a constant from this numeric expression.

Expression
subtract(subtrahend: Number)

Creates an expression that subtracts a numeric expressions from this numeric expression.

AggregateFunction
sum()

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

Expression

Creates an expression that adds a specified amount of time to this timestamp expression.

Expression
timestampAdd(unit: String, amount: Long)

Creates an expression that adds a specified amount of time to this timestamp expression.

Expression

Creates an expression that subtracts a specified amount of time to this timestamp expression.

Expression
timestampSubtract(unit: String, amount: Long)

Creates an expression that subtracts a specified amount of time to this timestamp expression.

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).

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).

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).

Expression

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

Expression
timestampTruncate(granularity: String)

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

Expression

Creates an expression that converts this string expression to lowercase.

Expression

Creates an expression that converts this string expression to uppercase.

Expression

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

Expression
trimValue(valueToTrim: Expression)

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

Expression
trimValue(valueToTrim: String)

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

Expression

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

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.

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.

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.

Expression

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

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int