Expression class abstract

A value computed by the server while it runs a pipeline: a Field reference, a Constant, or a FunctionExpression over other expressions.

Wherever a method takes an Object? operand, an Expression is used as is and any other value is treated as a constant.

Preview, Enterprise only: the Pipelines API is experimental, may change in any release and needs a Firestore Enterprise edition database.

Implementers

Constructors

Expression()
Constructor for subclasses.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

abs() → FunctionExpression
The absolute value of this number.
add(Object? other) → FunctionExpression
Adds other to this expression.
arrayAgg() → AggregateFunction
All values of this expression, as an array.
arrayAggDistinct() → AggregateFunction
The distinct values of this expression, as an array.
arrayConcat(List<Object?> others) → FunctionExpression
This array followed by the elements of the arrays in others.
arrayContains(Object? element) → BooleanExpression
Whether this array contains element.
arrayContainsAll(Object values) → BooleanExpression
Whether this array contains all of values, a List of values or expressions, or an Expression that evaluates to an array.
arrayContainsAny(Object values) → BooleanExpression
Whether this array contains at least one of values, a List of values or expressions, or an Expression that evaluates to an array.
arrayFilter(BooleanExpression filter(Expression element), {String alias = 'element'}) → FunctionExpression
The elements of this array for which filter holds.
arrayFirst() → FunctionExpression
The first element of this array.
arrayFirstN(Object n) → FunctionExpression
The first n elements of this array.
arrayGet(Object index) → FunctionExpression
The element at index of this array (negative counts from the end).
arrayIndexOf(Object? search) → FunctionExpression
The position of the first occurrence of search in this array, or -1.
arrayIndexOfAll(Object? search) → FunctionExpression
The positions of all occurrences of search in this array.
arrayLast() → FunctionExpression
The last element of this array.
arrayLastIndexOf(Object? search) → FunctionExpression
The position of the last occurrence of search in this array, or -1.
arrayLastN(Object n) → FunctionExpression
The last n elements of this array.
arrayLength() → FunctionExpression
The number of elements of this array.
arrayMaximum() → FunctionExpression
The largest element of this array.
arrayMaximumN(Object n) → FunctionExpression
The n largest elements of this array, largest first.
arrayMinimum() → FunctionExpression
The smallest element of this array.
arrayMinimumN(Object n) → FunctionExpression
The n smallest elements of this array, smallest first.
arrayReverse() → FunctionExpression
This array in reverse order.
arraySlice(Object offset, [Object? length]) → FunctionExpression
The elements of this array from offset, at most length of them.
arraySum() → FunctionExpression
The sum of the numeric elements of this array.
arrayTransform(Object? transform(Expression element), {String alias = 'element'}) → FunctionExpression
This array with every element replaced by the result of transform.
arrayTransformWithIndex(Object? transform(Expression element, Expression index), {String elementAlias = 'element', String indexAlias = 'index'}) → FunctionExpression
Like arrayTransform, but transform also receives an expression for the position of the element in the array.
as(String alias) → AliasedExpression
Gives this expression a name, for use in select, addFields and distinct.
asBoolean() → BooleanExpression
Treats this expression as a boolean, so that it can be used as a condition (for example a field that holds a boolean).
ascending() → Ordering
Sorts by this expression, smallest first.
average() → AggregateFunction
Averages the values of this expression.
byteLength() → FunctionExpression
The number of bytes of this string (in UTF-8) or of these bytes.
ceil() → FunctionExpression
This number rounded up to a whole number.
charLength() → FunctionExpression
The number of characters of this string.
coalesce(Object? replacement, [List<Object?> others = const <Object?>[]]) → FunctionExpression
The first of this value, replacement and others that is neither null nor absent.
collectionId() → FunctionExpression
The id of the collection of this document reference.
concat(List<Object?> others) → FunctionExpression
This value concatenated with others (strings, arrays or bytes).
cosineDistance(Object other) → FunctionExpression
The cosine distance between this vector and other (a VectorValue, a List<double> or an expression).
count() → AggregateFunction
Counts the inputs for which this expression has a value.
countDistinct() → AggregateFunction
Counts the distinct values of this expression.
descending() → Ordering
Sorts by this expression, largest first.
divide(Object? other) → FunctionExpression
Divides this expression by other.
documentId() → FunctionExpression
The document id of this document reference (or document path).
dotProduct(Object other) → FunctionExpression
The dot product of this vector and other; see cosineDistance.
endsWith(Object suffix) → BooleanExpression
Whether this string ends with suffix.
equal(Object? other) → BooleanExpression
Whether this expression is equal to other.
equalAny(Object values) → BooleanExpression
Whether this expression is equal to any of values, a List of values or expressions, or an Expression that evaluates to an array.
euclideanDistance(Object other) → FunctionExpression
The Euclidean distance between this vector and other; see cosineDistance.
exists() → BooleanExpression
Whether this expression (usually a Field) has a value in the document.
exp() → FunctionExpression
Euler's number raised to the power of this number.
first() → AggregateFunction
The value of this expression for the first input.
floor() → FunctionExpression
This number rounded down to a whole number.
geoDistance(Object location) → FunctionExpression
The distance in meters between this location and location (a GeoPoint or an expression).
getField(Object key) → FunctionExpression
The value of the field key of this map or document, for example of currentDocument() or of a variable that holds a document.
greaterThan(Object? other) → BooleanExpression
Whether this expression is greater than other.
greaterThanOrEqual(Object? other) → BooleanExpression
Whether this expression is greater than or equal to other.
ifAbsent(Object? elseValue) → FunctionExpression
This value, or elseValue if it is absent.
ifError(Object? catchValue) → FunctionExpression
This value, or catchValue if evaluating it fails.
ifNull(Object? elseValue) → FunctionExpression
This value, or elseValue if it is null.
isAbsent() → BooleanExpression
Whether this expression has no value in the document.
isError() → BooleanExpression
Whether evaluating this expression produces an error.
isType(String type) → BooleanExpression
Whether this value is of the type with the name type.
join(Object delimiter) → FunctionExpression
The elements of this array of strings, joined with delimiter.
last() → AggregateFunction
The value of this expression for the last input.
length() → FunctionExpression
The length of this string, array, map, vector or bytes value.
lessThan(Object? other) → BooleanExpression
Whether this expression is less than other.
lessThanOrEqual(Object? other) → BooleanExpression
Whether this expression is less than or equal to other.
like(Object pattern) → BooleanExpression
Whether this string matches the SQL-style LIKE pattern.
ln() → FunctionExpression
The natural logarithm of this number.
log(Object base) → FunctionExpression
The logarithm of this number to the given base.
log10() → FunctionExpression
The base 10 logarithm of this number.
logicalMaximum(List<Object?> others) → FunctionExpression
The largest of this value and others, in Firestore's value ordering.
logicalMinimum(List<Object?> others) → FunctionExpression
The smallest of this value and others, in Firestore's value ordering.
ltrim([Object? characters]) → FunctionExpression
Like trim, for the start of the string only.
mapEntries() → FunctionExpression
The entries of this map, as an array of maps with k and v.
mapGet(String key) → FunctionExpression
The value stored under key in this map.
mapKeys() → FunctionExpression
The keys of this map.
mapMerge(Object second, [List<Object> others = const <Object>[]]) → FunctionExpression
This map merged with second and others; later maps win.
mapRemove(Object key) → FunctionExpression
This map without the entry for key.
mapSet(Object key, Object? value, [List<Object?> moreKeyValues = const <Object?>[]]) → FunctionExpression
This map with key set to value.
mapValues() → FunctionExpression
The values of this map.
maximum() → AggregateFunction
The largest value of this expression.
minimum() → AggregateFunction
The smallest value of this expression.
mod(Object? other) → FunctionExpression
The remainder of dividing this expression by other.
multiply(Object? other) → FunctionExpression
Multiplies this expression by other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notEqual(Object? other) → BooleanExpression
Whether this expression is not equal to other.
notEqualAny(Object values) → BooleanExpression
Whether this expression is equal to none of values, a List of values or expressions, or an Expression that evaluates to an array.
parent() → FunctionExpression
The parent of this document reference.
pow(Object exponent) → FunctionExpression
This number raised to the power exponent.
regexContains(Object pattern) → BooleanExpression
Whether a part of this string matches the regular expression pattern.
regexFind(Object pattern) → FunctionExpression
The first part of this string that matches the regular expression pattern.
regexFindAll(Object pattern) → FunctionExpression
All parts of this string that match the regular expression pattern.
regexMatch(Object pattern) → BooleanExpression
Whether the whole string matches the regular expression pattern.
reverse() → FunctionExpression
This string, array or bytes value in reverse order.
round([Object? decimalPlaces]) → FunctionExpression
This number rounded to decimalPlaces (to a whole number without it).
rtrim([Object? characters]) → FunctionExpression
Like trim, for the end of the string only.
split(Object delimiter) → FunctionExpression
The parts of this string between occurrences of delimiter.
sqrt() → FunctionExpression
The square root of this number.
startsWith(Object prefix) → BooleanExpression
Whether this string starts with prefix.
stringConcat(List<Object?> others) → FunctionExpression
Concatenates this string with others.
stringContains(Object substring) → BooleanExpression
Whether this string contains substring.
stringIndexOf(Object search) → FunctionExpression
The position of the first occurrence of search in this string, or -1.
stringRepeat(Object repetitions) → FunctionExpression
This string repeated repetitions times.
stringReplaceAll(Object find, Object replacement) → FunctionExpression
This string with every occurrence of find replaced by replacement.
stringReplaceOne(Object find, Object replacement) → FunctionExpression
This string with the first occurrence of find replaced by replacement.
stringReverse() → FunctionExpression
This string with its characters in reverse order.
substring(Object position, [Object? length]) → FunctionExpression
The part of this string that starts at position (0-based) and has length characters, or runs to the end without length.
subtract(Object? other) → FunctionExpression
Subtracts other from this expression.
sum() → AggregateFunction
Sums the values of this expression.
timestampAdd(Object unit, Object amount) → FunctionExpression
This timestamp plus amount of unit ('microsecond', 'millisecond', 'second', 'minute', 'hour' or 'day').
timestampDiff(Object start, Object unit) → FunctionExpression
The number of whole units from start (a field name or an expression) to this timestamp.
timestampExtract(Object part, [Object? timezone]) → FunctionExpression
The part (for example 'year' or 'dayofweek') of this timestamp, optionally in timezone.
timestampSubtract(Object unit, Object amount) → FunctionExpression
This timestamp minus amount of unit; see timestampAdd.
timestampToUnixMicros() → FunctionExpression
This timestamp as microseconds since the Unix epoch.
timestampToUnixMillis() → FunctionExpression
This timestamp as milliseconds since the Unix epoch.
timestampToUnixSeconds() → FunctionExpression
This timestamp as seconds since the Unix epoch.
timestampTruncate(Object granularity, [Object? timezone]) → FunctionExpression
This timestamp truncated to granularity (for example 'day'), optionally in timezone.
toLower() → FunctionExpression
This string in lower case.
toString() → String
A string representation of this object.
inherited
toUpper() → FunctionExpression
This string in upper case.
trim([Object? characters]) → FunctionExpression
This string without leading and trailing whitespace, or without the leading and trailing characters of characters when given.
trunc([Object? decimalPlaces]) → FunctionExpression
This number cut off after decimalPlaces (at the decimal point without it).
type() → FunctionExpression
The name of the type of this value (for example 'string').
unixMicrosToTimestamp() → FunctionExpression
The timestamp this number of microseconds after the Unix epoch.
unixMillisToTimestamp() → FunctionExpression
The timestamp this number of milliseconds after the Unix epoch.
unixSecondsToTimestamp() → FunctionExpression
The timestamp this number of seconds after the Unix epoch.
vectorLength() → FunctionExpression
The number of dimensions of this vector.

Operators

operator ==(Object other) → bool
The equality operator.
inherited