java.lang.Object
com.google.cloud.firestore.pipeline.expressions.Expression
Direct Known Subclasses:
BooleanExpression, Field, FunctionExpression

@BetaApi public abstract class Expression extends Object
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.

  • Method Details

    • constant

      @BetaApi public static Expression constant(String value)
      Create a constant for a String value.
      Parameters:
      value - The String value.
      Returns:
      A new Expression constant instance.
    • constant

      @BetaApi public static Expression constant(Number value)
      Create a constant for a Number value.
      Parameters:
      value - The Number value.
      Returns:
      A new Expression constant instance.
    • constant

      @BetaApi public static Expression constant(Date value)
      Create a constant for a Date value.
      Parameters:
      value - The Date value.
      Returns:
      A new Expression constant instance.
    • constant

      @BetaApi public static Expression constant(com.google.cloud.Timestamp value)
      Create a constant for a Timestamp value.
      Parameters:
      value - The Timestamp value.
      Returns:
      A new Expression constant instance.
    • constant

      @BetaApi public static BooleanExpression constant(Boolean value)
      Create a constant for a Boolean value.
      Parameters:
      value - The Boolean value.
      Returns:
      A new BooleanExpression constant instance.
    • constant

      @BetaApi public static Expression constant(GeoPoint value)
      Create a constant for a GeoPoint value.
      Parameters:
      value - The GeoPoint value.
      Returns:
      A new Expression constant instance.
    • constant

      @BetaApi public static Expression constant(Blob value)
      Create a constant for a Blob value.
      Parameters:
      value - The Blob value.
      Returns:
      A new Expression constant instance.
    • constant

      @BetaApi public static Expression constant(DocumentReference value)
      Create a constant for a DocumentReference value.
      Parameters:
      value - The DocumentReference value.
      Returns:
      A new Expression constant instance.
    • constant

      @BetaApi public static Expression constant(byte[] value)
      Create a constant for a bytes value.
      Parameters:
      value - The bytes value.
      Returns:
      A new Expression constant instance.
    • constant

      @BetaApi public static Expression constant(VectorValue value)
      Create a constant for a VectorValue value.
      Parameters:
      value - The VectorValue value.
      Returns:
      A new Expression constant instance.
    • nullValue

      @BetaApi public static Expression nullValue()
      Constant for a null value.
      Returns:
      An Expression constant instance.
    • field

      @BetaApi public static Field field(String path)
      Creates a Field instance representing the field at the given path.

      The path can be a simple field name (e.g., "name") or a dot-separated path to a nested field (e.g., "address.city").

      Parameters:
      path - The path to the field.
      Returns:
      A new Field instance representing the specified path.
    • field

      @BetaApi public static Field field(FieldPath fieldPath)
      Creates a Field instance representing the field at the given path.

      The path can be a simple field name (e.g., "name") or a dot-separated path to a nested field (e.g., "address.city").

      Parameters:
      fieldPath - The FieldPath to the field.
      Returns:
      A new Field instance representing the specified path.
    • currentTimestamp

      @BetaApi public static Expression currentTimestamp()
      Creates an expression that returns the current timestamp.
      Returns:
      A new Expression representing the current timestamp.
    • ifAbsent

      @BetaApi public static Expression ifAbsent(Expression ifExpr, Expression elseExpr)
      Creates an expression that returns a default value if an expression evaluates to an absent value.
      Parameters:
      ifExpr - The expression to check.
      elseExpr - The default value.
      Returns:
      A new Expression representing the ifAbsent operation.
    • ifAbsent

      @BetaApi public static Expression ifAbsent(Expression ifExpr, Object elseValue)
      Creates an expression that returns a default value if an expression evaluates to an absent value.
      Parameters:
      ifExpr - The expression to check.
      elseValue - The default value.
      Returns:
      A new Expression representing the ifAbsent operation.
    • ifAbsent

      @BetaApi public static Expression ifAbsent(String ifFieldName, Expression elseExpr)
      Creates an expression that returns a default value if a field is absent.
      Parameters:
      ifFieldName - The field to check.
      elseExpr - The default value.
      Returns:
      A new Expression representing the ifAbsent operation.
    • ifAbsent

      @BetaApi public static Expression ifAbsent(String ifFieldName, Object elseValue)
      Creates an expression that returns a default value if a field is absent.
      Parameters:
      ifFieldName - The field to check.
      elseValue - The default value.
      Returns:
      A new Expression representing the ifAbsent operation.
    • join

      @BetaApi public static Expression join(Expression arrayExpression, String delimiter)
      Creates an expression that joins the elements of an array into a string.
      Parameters:
      arrayExpression - The expression representing the array.
      delimiter - The delimiter to use.
      Returns:
      A new Expression representing the join operation.
    • join

      @BetaApi public static Expression join(Expression arrayExpression, Expression delimiterExpression)
      Creates an expression that joins the elements of an array into a string.
      Parameters:
      arrayExpression - The expression representing the array.
      delimiterExpression - The expression representing the delimiter.
      Returns:
      A new Expression representing the join operation.
    • join

      @BetaApi public static Expression join(String arrayFieldName, String delimiter)
      Creates an expression that joins the elements of an array into a string.
      Parameters:
      arrayFieldName - The field name of the array.
      delimiter - The delimiter to use.
      Returns:
      A new Expression representing the join operation.
    • join

      @BetaApi public static Expression join(String arrayFieldName, Expression delimiterExpression)
      Creates an expression that joins the elements of an array into a string.
      Parameters:
      arrayFieldName - The field name of the array.
      delimiterExpression - The expression representing the delimiter.
      Returns:
      A new Expression representing the join operation.
    • rawExpression

      @BetaApi public static Expression rawExpression(String name, Expression... expr)
      Creates a generic function expression that is not yet implemented.
      Parameters:
      name - The name of the generic function.
      expr - The expressions to be passed as arguments to the function.
      Returns:
      A new Expression representing the generic function.
    • and

      @BetaApi public static BooleanExpression and(BooleanExpression condition, BooleanExpression... conditions)
      Creates an expression that performs a logical 'AND' operation.
      Parameters:
      condition - The first BooleanExpression.
      conditions - Additional BooleanExpressions.
      Returns:
      A new BooleanExpression representing the logical 'AND' operation.
    • or

      @BetaApi public static BooleanExpression or(BooleanExpression condition, BooleanExpression... conditions)
      Creates an expression that performs a logical 'OR' operation.
      Parameters:
      condition - The first BooleanExpression.
      conditions - Additional BooleanExpressions.
      Returns:
      A new BooleanExpression representing the logical 'OR' operation.
    • xor

      @BetaApi public static BooleanExpression xor(BooleanExpression condition, BooleanExpression... conditions)
      Creates an expression that performs a logical 'XOR' operation.
      Parameters:
      condition - The first BooleanExpression.
      conditions - Additional BooleanExpressions.
      Returns:
      A new BooleanExpression representing the logical 'XOR' operation.
    • not

      @BetaApi public static BooleanExpression not(BooleanExpression condition)
      Creates an expression that negates a boolean expression.
      Parameters:
      condition - The boolean expression to negate.
      Returns:
      A new BooleanExpression representing the not operation.
    • add

      @BetaApi public static Expression add(Expression first, Expression second)
      Creates an expression that adds numeric expressions.
      Parameters:
      first - Numeric expression to add.
      second - Numeric expression to add.
      Returns:
      A new Expression representing the addition operation.
    • add

      @BetaApi public static Expression add(Expression first, Number second)
      Creates an expression that adds numeric expressions with a constant.
      Parameters:
      first - Numeric expression to add.
      second - Constant to add.
      Returns:
      A new Expression representing the addition operation.
    • add

      @BetaApi public static Expression add(String fieldName, Expression second)
      Creates an expression that adds a numeric field with a numeric expression.
      Parameters:
      fieldName - Numeric field to add.
      second - Numeric expression to add to field value.
      Returns:
      A new Expression representing the addition operation.
    • add

      @BetaApi public static Expression add(String fieldName, Number second)
      Creates an expression that adds a numeric field with constant.
      Parameters:
      fieldName - Numeric field to add.
      second - Constant to add.
      Returns:
      A new Expression representing the addition operation.
    • subtract

      @BetaApi public static Expression subtract(Expression minuend, Expression subtrahend)
      Creates an expression that subtracts two expressions.
      Parameters:
      minuend - Numeric expression to subtract from.
      subtrahend - Numeric expression to subtract.
      Returns:
      A new Expression representing the subtract operation.
    • subtract

      @BetaApi public static Expression subtract(Expression minuend, Number subtrahend)
      Creates an expression that subtracts a constant value from a numeric expression.
      Parameters:
      minuend - Numeric expression to subtract from.
      subtrahend - Constant to subtract.
      Returns:
      A new Expression representing the subtract operation.
    • subtract

      @BetaApi public static Expression subtract(String fieldName, Expression subtrahend)
      Creates an expression that subtracts a numeric expressions from numeric field.
      Parameters:
      fieldName - Numeric field to subtract from.
      subtrahend - Numeric expression to subtract.
      Returns:
      A new Expression representing the subtract operation.
    • subtract

      @BetaApi public static Expression subtract(String fieldName, Number subtrahend)
      Creates an expression that subtracts a constant from numeric field.
      Parameters:
      fieldName - Numeric field to subtract from.
      subtrahend - Constant to subtract.
      Returns:
      A new Expression representing the subtract operation.
    • multiply

      @BetaApi public static Expression multiply(Expression first, Expression second)
      Creates an expression that multiplies numeric expressions.
      Parameters:
      first - Numeric expression to multiply.
      second - Numeric expression to multiply.
      Returns:
      A new Expression representing the multiplication operation.
    • multiply

      @BetaApi public static Expression multiply(Expression first, Number second)
      Creates an expression that multiplies numeric expressions with a constant.
      Parameters:
      first - Numeric expression to multiply.
      second - Constant to multiply.
      Returns:
      A new Expression representing the multiplication operation.
    • multiply

      @BetaApi public static Expression multiply(String fieldName, Expression second)
      Creates an expression that multiplies a numeric field with a numeric expression.
      Parameters:
      fieldName - Numeric field to multiply.
      second - Numeric expression to multiply.
      Returns:
      A new Expression representing the multiplication operation.
    • multiply

      @BetaApi public static Expression multiply(String fieldName, Number second)
      Creates an expression that multiplies a numeric field with a constant.
      Parameters:
      fieldName - Numeric field to multiply.
      second - Constant to multiply.
      Returns:
      A new Expression representing the multiplication operation.
    • divide

      @BetaApi public static Expression divide(Expression dividend, Expression divisor)
      Creates an expression that divides two numeric expressions.
      Parameters:
      dividend - The numeric expression to be divided.
      divisor - The numeric expression to divide by.
      Returns:
      A new Expression representing the division operation.
    • divide

      @BetaApi public static Expression divide(Expression dividend, Number divisor)
      Creates an expression that divides a numeric expression by a constant.
      Parameters:
      dividend - The numeric expression to be divided.
      divisor - The constant to divide by.
      Returns:
      A new Expression representing the division operation.
    • divide

      @BetaApi public static Expression divide(String fieldName, Expression divisor)
      Creates an expression that divides numeric field by a numeric expression.
      Parameters:
      fieldName - The numeric field name to be divided.
      divisor - The numeric expression to divide by.
      Returns:
      A new Expression representing the divide operation.
    • divide

      @BetaApi public static Expression divide(String fieldName, Number divisor)
      Creates an expression that divides a numeric field by a constant.
      Parameters:
      fieldName - The numeric field name to be divided.
      divisor - The constant to divide by.
      Returns:
      A new Expression representing the divide operation.
    • mod

      @BetaApi public static Expression mod(Expression dividend, Expression divisor)
      Creates an expression that calculates the modulo (remainder) of dividing two numeric expressions.
      Parameters:
      dividend - The numeric expression to be divided.
      divisor - The numeric expression to divide by.
      Returns:
      A new Expression representing the modulo operation.
    • mod

      @BetaApi public static Expression mod(Expression dividend, Number divisor)
      Creates an expression that calculates the modulo (remainder) of dividing a numeric expression by a constant.
      Parameters:
      dividend - The numeric expression to be divided.
      divisor - The constant to divide by.
      Returns:
      A new Expression representing the modulo operation.
    • mod

      @BetaApi public static Expression mod(String fieldName, Expression divisor)
      Creates an expression that calculates the modulo (remainder) of dividing a numeric field by a constant.
      Parameters:
      fieldName - The numeric field name to be divided.
      divisor - The numeric expression to divide by.
      Returns:
      A new Expression representing the modulo operation.
    • mod

      @BetaApi public static Expression mod(String fieldName, Number divisor)
      Creates an expression that calculates the modulo (remainder) of dividing a numeric field by a constant.
      Parameters:
      fieldName - The numeric field name to be divided.
      divisor - The constant to divide by.
      Returns:
      A new Expression representing the modulo operation.
    • equal

      @BetaApi public static BooleanExpression equal(Expression left, Expression right)
      Creates an expression that checks if two expressions are equal.
      Parameters:
      left - The first expression.
      right - The second expression.
      Returns:
      A new BooleanExpression representing the equality comparison.
    • equal

      @BetaApi public static BooleanExpression equal(Expression left, Object right)
      Creates an expression that checks if an expression is equal to a constant value.
      Parameters:
      left - The expression.
      right - The constant value.
      Returns:
      A new BooleanExpression representing the equality comparison.
    • equal

      @BetaApi public static BooleanExpression equal(String fieldName, Expression right)
      Creates an expression that checks if a field is equal to an expression.
      Parameters:
      fieldName - The field name.
      right - The expression.
      Returns:
      A new BooleanExpression representing the equality comparison.
    • equal

      @BetaApi public static BooleanExpression equal(String fieldName, Object right)
      Creates an expression that checks if a field is equal to a constant value.
      Parameters:
      fieldName - The field name.
      right - The constant value.
      Returns:
      A new BooleanExpression representing the equality comparison.
    • notEqual

      @BetaApi public static BooleanExpression notEqual(Expression left, Expression right)
      Creates an expression that checks if two expressions are not equal.
      Parameters:
      left - The first expression.
      right - The second expression.
      Returns:
      A new BooleanExpression representing the inequality comparison.
    • notEqual

      @BetaApi public static BooleanExpression notEqual(Expression left, Object right)
      Creates an expression that checks if an expression is not equal to a constant value.
      Parameters:
      left - The expression.
      right - The constant value.
      Returns:
      A new BooleanExpression representing the inequality comparison.
    • notEqual

      @BetaApi public static BooleanExpression notEqual(String fieldName, Expression right)
      Creates an expression that checks if a field is not equal to an expression.
      Parameters:
      fieldName - The field name.
      right - The expression.
      Returns:
      A new BooleanExpression representing the inequality comparison.
    • notEqual

      @BetaApi public static BooleanExpression notEqual(String fieldName, Object right)
      Creates an expression that checks if a field is not equal to a constant value.
      Parameters:
      fieldName - The field name.
      right - The constant value.
      Returns:
      A new BooleanExpression representing the inequality comparison.
    • greaterThan

      @BetaApi public static BooleanExpression greaterThan(Expression left, Expression right)
      Creates an expression that checks if the first expression is greater than the second expression.
      Parameters:
      left - The first expression.
      right - The second expression.
      Returns:
      A new BooleanExpression representing the greater than comparison.
    • greaterThan

      @BetaApi public static BooleanExpression greaterThan(Expression left, Object right)
      Creates an expression that checks if an expression is greater than a constant value.
      Parameters:
      left - The expression.
      right - The constant value.
      Returns:
      A new BooleanExpression representing the greater than comparison.
    • greaterThan

      @BetaApi public static BooleanExpression greaterThan(String fieldName, Expression right)
      Creates an expression that checks if a field is greater than an expression.
      Parameters:
      fieldName - The field name.
      right - The expression.
      Returns:
      A new BooleanExpression representing the greater than comparison.
    • greaterThan

      @BetaApi public static BooleanExpression greaterThan(String fieldName, Object right)
      Creates an expression that checks if a field is greater than a constant value.
      Parameters:
      fieldName - The field name.
      right - The constant value.
      Returns:
      A new BooleanExpression representing the greater than comparison.
    • greaterThanOrEqual

      @BetaApi public static BooleanExpression greaterThanOrEqual(Expression left, Expression right)
      Creates an expression that checks if the first expression is greater than or equal to the second expression.
      Parameters:
      left - The first expression.
      right - The second expression.
      Returns:
      A new BooleanExpression representing the greater than or equal to comparison.
    • greaterThanOrEqual

      @BetaApi public static BooleanExpression greaterThanOrEqual(Expression left, Object right)
      Creates an expression that checks if an expression is greater than or equal to a constant value.
      Parameters:
      left - The expression.
      right - The constant value.
      Returns:
      A new BooleanExpression representing the greater than or equal to comparison.
    • greaterThanOrEqual

      @BetaApi public static BooleanExpression greaterThanOrEqual(String fieldName, Expression right)
      Creates an expression that checks if a field is greater than or equal to an expression.
      Parameters:
      fieldName - The field name.
      right - The expression.
      Returns:
      A new BooleanExpression representing the greater than or equal to comparison.
    • greaterThanOrEqual

      @BetaApi public static BooleanExpression greaterThanOrEqual(String fieldName, Object right)
      Creates an expression that checks if a field is greater than or equal to a constant value.
      Parameters:
      fieldName - The field name.
      right - The constant value.
      Returns:
      A new BooleanExpression representing the greater than or equal to comparison.
    • lessThan

      @BetaApi public static BooleanExpression lessThan(Expression left, Expression right)
      Creates an expression that checks if the first expression is less than the second expression.
      Parameters:
      left - The first expression.
      right - The second expression.
      Returns:
      A new BooleanExpression representing the less than comparison.
    • lessThan

      @BetaApi public static BooleanExpression lessThan(Expression left, Object right)
      Creates an expression that checks if an expression is less than a constant value.
      Parameters:
      left - The expression.
      right - The constant value.
      Returns:
      A new BooleanExpression representing the less than comparison.
    • lessThan

      @BetaApi public static BooleanExpression lessThan(String fieldName, Expression right)
      Creates an expression that checks if a field is less than an expression.
      Parameters:
      fieldName - The field name.
      right - The expression.
      Returns:
      A new BooleanExpression representing the less than comparison.
    • lessThan

      @BetaApi public static BooleanExpression lessThan(String fieldName, Object right)
      Creates an expression that checks if a field is less than a constant value.
      Parameters:
      fieldName - The field name.
      right - The constant value.
      Returns:
      A new BooleanExpression representing the less than comparison.
    • lessThanOrEqual

      @BetaApi public static BooleanExpression lessThanOrEqual(Expression left, Expression right)
      Creates an expression that checks if the first expression is less than or equal to the second expression.
      Parameters:
      left - The first expression.
      right - The second expression.
      Returns:
      A new BooleanExpression representing the less than or equal to comparison.
    • lessThanOrEqual

      @BetaApi public static BooleanExpression lessThanOrEqual(Expression left, Object right)
      Creates an expression that checks if an expression is less than or equal to a constant value.
      Parameters:
      left - The expression.
      right - The constant value.
      Returns:
      A new BooleanExpression representing the less than or equal to comparison.
    • lessThanOrEqual

      @BetaApi public static BooleanExpression lessThanOrEqual(String fieldName, Expression right)
      Creates an expression that checks if a field is less than or equal to an expression.
      Parameters:
      fieldName - The field name.
      right - The expression.
      Returns:
      A new BooleanExpression representing the less than or equal to comparison.
    • lessThanOrEqual

      @BetaApi public static BooleanExpression lessThanOrEqual(String fieldName, Object right)
      Creates an expression that checks if a field is less than or equal to a constant value.
      Parameters:
      fieldName - The field name.
      right - The constant value.
      Returns:
      A new BooleanExpression representing the less than or equal to comparison.
    • equalAny

      @BetaApi public static BooleanExpression equalAny(Expression expression, List<Object> values)
      Creates an expression that checks if an expression, when evaluated, is equal to any of the provided values.
      Parameters:
      expression - The expression whose results to compare.
      values - The values to check against.
      Returns:
      A new BooleanExpression representing the 'IN' comparison.
    • equalAny

      @BetaApi public static BooleanExpression equalAny(Expression expression, Expression arrayExpression)
      Creates an expression that checks if an expression, when evaluated, is equal to any of the elements of arrayExpression.
      Parameters:
      expression - The expression whose results to compare.
      arrayExpression - An expression that evaluates to an array, whose elements to check for equality to the input.
      Returns:
      A new BooleanExpression representing the 'IN' comparison.
    • equalAny

      @BetaApi public static BooleanExpression equalAny(String fieldName, List<Object> values)
      Creates an expression that checks if a field's value is equal to any of the provided values.
      Parameters:
      fieldName - The field to compare.
      values - The values to check against.
      Returns:
      A new BooleanExpression representing the 'IN' comparison.
    • equalAny

      @BetaApi public static BooleanExpression equalAny(String fieldName, Expression arrayExpression)
      Creates an expression that checks if a field's value is equal to any of the elements of arrayExpression.
      Parameters:
      fieldName - The field to compare.
      arrayExpression - An expression that evaluates to an array, whose elements to check for equality to the input.
      Returns:
      A new BooleanExpression representing the 'IN' comparison.
    • notEqualAny

      @BetaApi public static BooleanExpression notEqualAny(Expression expression, List<Object> values)
      Creates an expression that checks if an expression, when evaluated, is not equal to all the provided values.
      Parameters:
      expression - The expression whose results to compare.
      values - The values to check against.
      Returns:
      A new BooleanExpression representing the 'NOT IN' comparison.
    • notEqualAny

      @BetaApi public static BooleanExpression notEqualAny(Expression expression, Expression arrayExpression)
      Creates an expression that checks if an expression, when evaluated, is not equal to all the elements of arrayExpression.
      Parameters:
      expression - The expression whose results to compare.
      arrayExpression - An expression that evaluates to an array, whose elements to check for equality to the input.
      Returns:
      A new BooleanExpression representing the 'NOT IN' comparison.
    • notEqualAny

      @BetaApi public static BooleanExpression notEqualAny(String fieldName, List<Object> values)
      Creates an expression that checks if a field's value is not equal to all of the provided values.
      Parameters:
      fieldName - The field to compare.
      values - The values to check against.
      Returns:
      A new BooleanExpression representing the 'NOT IN' comparison.
    • notEqualAny

      @BetaApi public static BooleanExpression notEqualAny(String fieldName, Expression arrayExpression)
      Creates an expression that checks if a field's value is not equal to all of the elements of arrayExpression.
      Parameters:
      fieldName - The field to compare.
      arrayExpression - An expression that evaluates to an array, whose elements to check for equality to the input.
      Returns:
      A new BooleanExpression representing the 'NOT IN' comparison.
    • charLength

      @BetaApi public static Expression charLength(Expression string)
      Creates an expression that calculates the character length of a string expression in UTF8.
      Parameters:
      string - The expression representing the string.
      Returns:
      A new Expression representing the charLength operation.
    • charLength

      @BetaApi public static Expression charLength(String fieldName)
      Creates an expression that calculates the character length of a string field in UTF8.
      Parameters:
      fieldName - The name of the field containing the string.
      Returns:
      A new Expression representing the charLength operation.
    • byteLength

      @BetaApi public static Expression byteLength(Expression string)
      Creates an expression that calculates the length of a string in UTF-8 bytes, or just the length of a Blob.
      Parameters:
      string - The expression representing the string.
      Returns:
      A new Expression representing the length of the string in bytes.
    • byteLength

      @BetaApi public static Expression byteLength(String fieldName)
      Creates an expression that calculates the length of a string represented by a field in UTF-8 bytes, or just the length of a Blob.
      Parameters:
      fieldName - The name of the field containing the string.
      Returns:
      A new Expression representing the length of the string in bytes.
    • length

      @BetaApi public static Expression length(Expression string)
      Creates an expression that calculates the length of string, array, map, vector, or Blob.
      Parameters:
      string - The expression representing the value to calculate the length of.
      Returns:
      A new Expression representing the length of the value.
    • length

      @BetaApi public static Expression length(String fieldName)
      Creates an expression that calculates the length of string, array, map, vector, or Blob.
      Parameters:
      fieldName - The name of the field containing the value.
      Returns:
      A new Expression representing the length of the value.
    • like

      @BetaApi public static BooleanExpression like(Expression string, Expression pattern)
      Creates an expression that performs a case-sensitive wildcard string comparison.
      Parameters:
      string - The expression representing the string to perform the comparison on.
      pattern - The pattern to search for. You can use "%" as a wildcard character.
      Returns:
      A new BooleanExpression representing the like operation.
    • like

      @BetaApi public static BooleanExpression like(Expression string, String pattern)
      Creates an expression that performs a case-sensitive wildcard string comparison.
      Parameters:
      string - The expression representing the string to perform the comparison on.
      pattern - The pattern to search for. You can use "%" as a wildcard character.
      Returns:
      A new BooleanExpression representing the like operation.
    • like

      @BetaApi public static BooleanExpression like(String fieldName, Expression pattern)
      Creates an expression that performs a case-sensitive wildcard string comparison against a field.
      Parameters:
      fieldName - The name of the field containing the string.
      pattern - The pattern to search for. You can use "%" as a wildcard character.
      Returns:
      A new BooleanExpression representing the like comparison.
    • like

      @BetaApi public static BooleanExpression like(String fieldName, String pattern)
      Creates an expression that performs a case-sensitive wildcard string comparison against a field.
      Parameters:
      fieldName - The name of the field containing the string.
      pattern - The pattern to search for. You can use "%" as a wildcard character.
      Returns:
      A new BooleanExpression representing the like comparison.
    • regexContains

      @BetaApi public static BooleanExpression regexContains(Expression string, Expression pattern)
      Creates an expression that checks if a string expression contains a specified regular expression as a substring.
      Parameters:
      string - The expression representing the string to perform the comparison on.
      pattern - The regular expression to use for the search.
      Returns:
      A new BooleanExpression representing the contains regular expression comparison.
    • regexContains

      @BetaApi public static BooleanExpression regexContains(Expression string, String pattern)
      Creates an expression that checks if a string expression contains a specified regular expression as a substring.
      Parameters:
      string - The expression representing the string to perform the comparison on.
      pattern - The regular expression to use for the search.
      Returns:
      A new BooleanExpression representing the contains regular expression comparison.
    • regexContains

      @BetaApi public static BooleanExpression regexContains(String fieldName, Expression pattern)
      Creates an expression that checks if a string field contains a specified regular expression as a substring.
      Parameters:
      fieldName - The name of the field containing the string.
      pattern - The regular expression to use for the search.
      Returns:
      A new BooleanExpression representing the contains regular expression comparison.
    • regexContains

      @BetaApi public static BooleanExpression regexContains(String fieldName, String pattern)
      Creates an expression that checks if a string field contains a specified regular expression as a substring.
      Parameters:
      fieldName - The name of the field containing the string.
      pattern - The regular expression to use for the search.
      Returns:
      A new BooleanExpression representing the contains regular expression comparison.
    • regexFind

      @BetaApi public static Expression regexFind(Expression string, 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.

      Parameters:
      string - The expression representing the string to search.
      pattern - The regular expression to search for.
      Returns:
      A new Expression representing the regular expression find function.
    • regexFind

      @BetaApi public static Expression regexFind(Expression string, 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.

      Parameters:
      string - The expression representing the string to search.
      pattern - The regular expression to search for.
      Returns:
      A new Expression representing the regular expression find function.
    • regexFind

      @BetaApi public static Expression regexFind(String fieldName, 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.

      Parameters:
      fieldName - The name of the field containing the string to search.
      pattern - The regular expression to search for.
      Returns:
      A new Expression representing the regular expression find function.
    • regexFind

      @BetaApi public static Expression regexFind(String fieldName, 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.

      Parameters:
      fieldName - The name of the field containing the string to search.
      pattern - The regular expression to search for.
      Returns:
      A new Expression representing the regular expression find function.
    • regexFindAll

      @BetaApi public static Expression regexFindAll(Expression string, 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.

      Parameters:
      string - The expression representing the string to search.
      pattern - The regular expression to search for.
      Returns:
      A new Expression that evaluates to a list of matched substrings.
    • regexFindAll

      @BetaApi public static Expression regexFindAll(Expression string, 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.

      Parameters:
      string - The expression representing the string to search.
      pattern - The regular expression to search for.
      Returns:
      A new Expression that evaluates to a list of matched substrings.
    • regexFindAll

      @BetaApi public static Expression regexFindAll(String fieldName, 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.

      Parameters:
      fieldName - The name of the field containing the string to search.
      pattern - The regular expression to search for.
      Returns:
      A new Expression that evaluates to a list of matched substrings.
    • regexFindAll

      @BetaApi public static Expression regexFindAll(String fieldName, 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.

      Parameters:
      fieldName - The name of the field containing the string to search.
      pattern - The regular expression to search for.
      Returns:
      A new Expression that evaluates to a list of matched substrings.
    • regexMatch

      @BetaApi public static BooleanExpression regexMatch(Expression string, Expression pattern)
      Creates an expression that checks if a string field matches a specified regular expression.
      Parameters:
      string - The expression representing the string to match against.
      pattern - The regular expression to use for the match.
      Returns:
      A new BooleanExpression representing the regular expression match comparison.
    • regexMatch

      @BetaApi public static BooleanExpression regexMatch(Expression string, String pattern)
      Creates an expression that checks if a string field matches a specified regular expression.
      Parameters:
      string - The expression representing the string to match against.
      pattern - The regular expression to use for the match.
      Returns:
      A new BooleanExpression representing the regular expression match comparison.
    • regexMatch

      @BetaApi public static BooleanExpression regexMatch(String fieldName, Expression pattern)
      Creates an expression that checks if a string field matches a specified regular expression.
      Parameters:
      fieldName - The name of the field containing the string.
      pattern - The regular expression to use for the match.
      Returns:
      A new BooleanExpression representing the regular expression match comparison.
    • regexMatch

      @BetaApi public static BooleanExpression regexMatch(String fieldName, String pattern)
      Creates an expression that checks if a string field matches a specified regular expression.
      Parameters:
      fieldName - The name of the field containing the string.
      pattern - The regular expression to use for the match.
      Returns:
      A new BooleanExpression representing the regular expression match comparison.
    • stringContains

      @BetaApi public static BooleanExpression stringContains(Expression string, Expression substring)
      Creates an expression that checks if a string expression contains a specified substring.
      Parameters:
      string - The expression representing the string to perform the comparison on.
      substring - The expression representing the substring to search for.
      Returns:
      A new BooleanExpression representing the contains comparison.
    • stringContains

      @BetaApi public static BooleanExpression stringContains(Expression string, String substring)
      Creates an expression that checks if a string expression contains a specified substring.
      Parameters:
      string - The expression representing the string to perform the comparison on.
      substring - The substring to search for.
      Returns:
      A new BooleanExpression representing the contains comparison.
    • stringContains

      @BetaApi public static BooleanExpression stringContains(String fieldName, Expression substring)
      Creates an expression that checks if a string field contains a specified substring.
      Parameters:
      fieldName - The name of the field to perform the comparison on.
      substring - The expression representing the substring to search for.
      Returns:
      A new BooleanExpression representing the contains comparison.
    • stringContains

      @BetaApi public static BooleanExpression stringContains(String fieldName, String substring)
      Creates an expression that checks if a string field contains a specified substring.
      Parameters:
      fieldName - The name of the field to perform the comparison on.
      substring - The substring to search for.
      Returns:
      A new BooleanExpression representing the contains comparison.
    • startsWith

      @BetaApi public static BooleanExpression startsWith(Expression string, Expression prefix)
      Creates an expression that checks if a string expression starts with a given prefix.
      Parameters:
      string - The expression to check.
      prefix - The prefix string expression to check for.
      Returns:
      A new BooleanExpression representing the 'starts with' comparison.
    • startsWith

      @BetaApi public static BooleanExpression startsWith(Expression string, String prefix)
      Creates an expression that checks if a string expression starts with a given prefix.
      Parameters:
      string - The expression to check.
      prefix - The prefix string to check for.
      Returns:
      A new BooleanExpression representing the 'starts with' comparison.
    • startsWith

      @BetaApi public static BooleanExpression startsWith(String fieldName, Expression prefix)
      Creates an expression that checks if a string expression starts with a given prefix.
      Parameters:
      fieldName - The name of field that contains a string to check.
      prefix - The prefix string expression to check for.
      Returns:
      A new BooleanExpression representing the 'starts with' comparison.
    • startsWith

      @BetaApi public static BooleanExpression startsWith(String fieldName, String prefix)
      Creates an expression that checks if a string expression starts with a given prefix.
      Parameters:
      fieldName - The name of field that contains a string to check.
      prefix - The prefix string to check for.
      Returns:
      A new BooleanExpression representing the 'starts with' comparison.
    • endsWith

      @BetaApi public static BooleanExpression endsWith(Expression string, Expression suffix)
      Creates an expression that checks if a string expression ends with a given suffix.
      Parameters:
      string - The expression to check.
      suffix - The suffix string expression to check for.
      Returns:
      A new BooleanExpression representing the 'ends with' comparison.
    • endsWith

      @BetaApi public static BooleanExpression endsWith(Expression string, String suffix)
      Creates an expression that checks if a string expression ends with a given suffix.
      Parameters:
      string - The expression to check.
      suffix - The suffix string to check for.
      Returns:
      A new BooleanExpression representing the 'ends with' comparison.
    • endsWith

      @BetaApi public static BooleanExpression endsWith(String fieldName, Expression suffix)
      Creates an expression that checks if a string expression ends with a given suffix.
      Parameters:
      fieldName - The name of field that contains a string to check.
      suffix - The suffix string expression to check for.
      Returns:
      A new BooleanExpression representing the 'ends with' comparison.
    • endsWith

      @BetaApi public static BooleanExpression endsWith(String fieldName, String suffix)
      Creates an expression that checks if a string expression ends with a given suffix.
      Parameters:
      fieldName - The name of field that contains a string to check.
      suffix - The suffix string to check for.
      Returns:
      A new BooleanExpression representing the 'ends with' comparison.
    • substring

      @BetaApi public static Expression substring(Expression string, Expression index, Expression length)
      Creates an expression that returns a substring of the given string.
      Parameters:
      string - The expression representing the string to get a substring from.
      index - The starting index of the substring.
      length - The length of the substring.
      Returns:
      A new Expression representing the substring.
    • substring

      @BetaApi public static Expression substring(String fieldName, int index, int length)
      Creates an expression that returns a substring of the given string.
      Parameters:
      fieldName - The name of the field containing the string to get a substring from.
      index - The starting index of the substring.
      length - The length of the substring.
      Returns:
      A new Expression representing the substring.
    • toLower

      @BetaApi public static Expression toLower(Expression string)
      Creates an expression that converts a string expression to lowercase.
      Parameters:
      string - The expression representing the string to convert to lowercase.
      Returns:
      A new Expression representing the lowercase string.
    • toLower

      @BetaApi public static Expression toLower(String fieldName)
      Creates an expression that converts a string field to lowercase.
      Parameters:
      fieldName - The name of the field containing the string to convert to lowercase.
      Returns:
      A new Expression representing the lowercase string.
    • toUpper

      @BetaApi public static Expression toUpper(Expression string)
      Creates an expression that converts a string expression to uppercase.
      Parameters:
      string - The expression representing the string to convert to uppercase.
      Returns:
      A new Expression representing the lowercase string.
    • toUpper

      @BetaApi public static Expression toUpper(String fieldName)
      Creates an expression that converts a string field to uppercase.
      Parameters:
      fieldName - The name of the field containing the string to convert to uppercase.
      Returns:
      A new Expression representing the lowercase string.
    • trim

      @BetaApi public static Expression trim(Expression string)
      Creates an expression that removes leading and trailing whitespace from a string expression.
      Parameters:
      string - The expression representing the string to trim.
      Returns:
      A new Expression representing the trimmed string.
    • trim

      @BetaApi public static Expression trim(String fieldName)
      Creates an expression that removes leading and trailing whitespace from a string field.
      Parameters:
      fieldName - The name of the field containing the string to trim.
      Returns:
      A new Expression representing the trimmed string.
    • trimValue

      @BetaApi public static Expression trimValue(Expression value, String characters)
      Creates an expression that removes specified characters from the beginning and end of a string or blob.
      Parameters:
      value - The expression representing the string or blob to trim.
      characters - The characters to remove.
      Returns:
      A new Expression representing the trimmed string or blob.
    • trimValue

      @BetaApi public static Expression trimValue(String fieldName, String characters)
      Creates an expression that removes specified characters from the beginning and end of a string or blob.
      Parameters:
      fieldName - The name of the field containing the string or blob to trim.
      characters - The characters to remove.
      Returns:
      A new Expression representing the trimmed string or blob.
    • trimValue

      @BetaApi public static Expression trimValue(Expression value, Expression characters)
      Creates an expression that removes specified characters from the beginning and end of a string or blob.
      Parameters:
      value - The expression representing the string or blob to trim.
      characters - The expression representing the characters to remove.
      Returns:
      A new Expression representing the trimmed string or blob.
    • trimValue

      @BetaApi public static Expression trimValue(String fieldName, Expression characters)
      Creates an expression that removes specified characters from the beginning and end of a string or blob.
      Parameters:
      fieldName - The name of the field containing the string or blob to trim.
      characters - The expression representing the characters to remove.
      Returns:
      A new Expression representing the trimmed string or blob.
    • split

      @BetaApi public static Expression split(Expression value, Expression delimiter)
      Creates an expression that splits a string or blob by a delimiter.
      Parameters:
      value - The expression representing the string or blob to split.
      delimiter - The delimiter to split by.
      Returns:
      A new Expression representing the split string or blob as an array.
    • split

      @BetaApi public static Expression split(Expression value, String delimiter)
      Creates an expression that splits a string or blob by a delimiter.
      Parameters:
      value - The expression representing the string or blob to split.
      delimiter - The delimiter to split by.
      Returns:
      A new Expression representing the split string or blob as an array.
    • split

      @BetaApi public static Expression split(String fieldName, Expression delimiter)
      Creates an expression that splits a string or blob by a delimiter.
      Parameters:
      fieldName - The name of the field containing the string or blob to split.
      delimiter - The delimiter to split by.
      Returns:
      A new Expression representing the split string or blob as an array.
    • split

      @BetaApi public static Expression split(String fieldName, String delimiter)
      Creates an expression that splits a string or blob by a delimiter.
      Parameters:
      fieldName - The name of the field containing the string or blob to split.
      delimiter - The delimiter to split by.
      Returns:
      A new Expression representing the split string or blob as an array.
    • stringConcat

      @BetaApi public static Expression stringConcat(Expression firstString, Object... otherStrings)
      Creates an expression that concatenates string expressions together.
      Parameters:
      firstString - The expression representing the initial string value.
      otherStrings - Optional additional string expressions or string constants to concatenate.
      Returns:
      A new Expression representing the concatenated string.
    • stringConcat

      @BetaApi public static Expression stringConcat(String fieldName, Object... otherStrings)
      Creates an expression that concatenates string expressions together.
      Parameters:
      fieldName - The field name containing the initial string value.
      otherStrings - Optional additional string expressions or string constants to concatenate.
      Returns:
      A new Expression representing the concatenated string.
    • concat

      @BetaApi public static Expression concat(Expression first, Object... others)
      Creates an expression that concatenates expressions together.
      Parameters:
      first - The expression representing the initial value.
      others - Optional additional expressions or constants to concatenate.
      Returns:
      A new Expression representing the concatenated value.
    • concat

      @BetaApi public static Expression concat(String fieldName, Object... others)
      Creates an expression that concatenates expressions together.
      Parameters:
      fieldName - The field name containing the initial value.
      others - Optional additional expressions or constants to concatenate.
      Returns:
      A new Expression representing the concatenated value.
    • map

      @BetaApi public static Expression map(Map<String,Object> elements)
      Creates an expression that creates a Firestore map value from an input object.
      Parameters:
      elements - The input map to evaluate in the expression.
      Returns:
      A new Expression representing the map function.
    • mapGet

      @BetaApi public static Expression mapGet(Expression map, Expression key)
      Accesses a value from a map (object) field using the provided keyExpression.
      Parameters:
      map - The expression representing the map.
      key - The key to access in the map.
      Returns:
      A new Expression representing the value associated with the given key in the map.
    • mapGet

      @BetaApi public static Expression mapGet(Expression map, String key)
      Accesses a value from a map (object) field using the provided key.
      Parameters:
      map - The expression representing the map.
      key - The key to access in the map.
      Returns:
      A new Expression representing the value associated with the given key in the map.
    • mapGet

      @BetaApi public static Expression mapGet(String fieldName, String key)
      Accesses a value from a map (object) field using the provided key.
      Parameters:
      fieldName - The field name of the map field.
      key - The key to access in the map.
      Returns:
      A new Expression representing the value associated with the given key in the map.
    • mapGet

      @BetaApi public static Expression mapGet(String fieldName, Expression key)
      Accesses a value from a map (object) field using the provided keyExpression.
      Parameters:
      fieldName - The field name of the map field.
      key - The key to access in the map.
      Returns:
      A new Expression representing the value associated with the given key in the map.
    • mapMerge

      @BetaApi public static Expression mapMerge(Expression firstMap, Expression secondMap)
    • mapMerge

      @BetaApi public static Expression mapMerge(String firstMapFieldName, Expression secondMap)
    • mapMerge

      @BetaApi public static Expression mapMerge(Expression firstMap, Expression secondMap, Expression... otherMaps)
      Creates an expression that merges multiple maps into a single map. If multiple maps have the same key, the later value is used.
      Parameters:
      firstMap - First map expression that will be merged.
      secondMap - Second map expression that will be merged.
      otherMaps - Additional maps to merge.
      Returns:
      A new Expression representing the mapMerge operation.
    • mapMerge

      @BetaApi public static Expression mapMerge(String firstMapFieldName, Expression secondMap, Expression... otherMaps)
      Creates an expression that merges multiple maps into a single map. If multiple maps have the same key, the later value is used.
      Parameters:
      firstMapFieldName - Field name of the first map expression that will be merged.
      secondMap - Second map expression that will be merged.
      otherMaps - Additional maps to merge.
      Returns:
      A new Expression representing the mapMerge operation.
    • mapRemove

      @BetaApi public static Expression mapRemove(Expression mapExpr, Expression key)
      Creates an expression that removes a key from a map.
      Parameters:
      mapExpr - The expression representing the map.
      key - The key to remove from the map.
      Returns:
      A new Expression representing the map with the key removed.
    • mapRemove

      @BetaApi public static Expression mapRemove(String mapField, Expression key)
      Creates an expression that removes a key from a map.
      Parameters:
      mapField - The field name of the map.
      key - The key to remove from the map.
      Returns:
      A new Expression representing the map with the key removed.
    • mapRemove

      @BetaApi public static Expression mapRemove(Expression mapExpr, String key)
      Creates an expression that removes a key from a map.
      Parameters:
      mapExpr - The expression representing the map.
      key - The key to remove from the map.
      Returns:
      A new Expression representing the map with the key removed.
    • mapRemove

      @BetaApi public static Expression mapRemove(String mapField, String key)
      Creates an expression that removes a key from a map.
      Parameters:
      mapField - The field name of the map.
      key - The key to remove from the map.
      Returns:
      A new Expression representing the map with the key removed.
    • reverse

      @BetaApi public static Expression reverse(Expression expr)
      Creates an expression that reverses a string, blob, or array.
      Parameters:
      expr - An expression evaluating to a string, blob, or array value, which will be reversed.
      Returns:
      A new Expression representing the reversed value.
    • reverse

      @BetaApi public static Expression reverse(String fieldName)
      Creates an expression that reverses the field value, which must be a string, blob, or array.
      Parameters:
      fieldName - A field evaluating to a string, blob, or array value.
      Returns:
      A new Expression representing the reversed value.
    • array

      @BetaApi public static Expression array(Object... elements)
      Creates an expression that creates a Firestore array value from an input object.
      Parameters:
      elements - The input elements to evaluate in the expression.
      Returns:
      A new Expression representing the array function.
    • array

      @BetaApi public static Expression array(List<Object> elements)
      Creates an expression that creates a Firestore array value from an input object.
      Parameters:
      elements - The input elements to evaluate in the expression.
      Returns:
      A new Expression representing the array function.
    • arrayConcat

      @BetaApi public static Expression arrayConcat(Expression firstArray, Object... otherArrays)
      Creates an expression that concatenates multiple arrays into a single array.
      Parameters:
      firstArray - The first array expression to concatenate.
      otherArrays - Additional arrays to concatenate.
      Returns:
      A new Expression representing the concatenated array.
    • arrayConcat

      @BetaApi public static Expression arrayConcat(String firstArrayField, Object... otherArrays)
      Creates an expression that concatenates multiple arrays into a single array.
      Parameters:
      firstArrayField - The field name of the first array to concatenate.
      otherArrays - Additional arrays to concatenate.
      Returns:
      A new Expression representing the concatenated array.
    • arrayReverse

      @BetaApi public static Expression arrayReverse(Expression array)
      Creates an expression that reverses an array.
      Parameters:
      array - The expression representing the array to reverse.
      Returns:
      A new Expression representing the reversed array.
    • arrayReverse

      @BetaApi public static Expression arrayReverse(String arrayFieldName)
      Creates an expression that reverses an array.
      Parameters:
      arrayFieldName - The field name of the array to reverse.
      Returns:
      A new Expression representing the reversed array.
    • arrayContains

      @BetaApi public static BooleanExpression arrayContains(Expression array, Expression element)
      Creates an expression that checks if an array contains a specified element.
      Parameters:
      array - The expression representing the array.
      element - The element to check for.
      Returns:
      A new BooleanExpression representing the array contains comparison.
    • arrayContains

      @BetaApi public static BooleanExpression arrayContains(String arrayFieldName, Expression element)
      Creates an expression that checks if an array contains a specified element.
      Parameters:
      arrayFieldName - The field name of the array.
      element - The element to check for.
      Returns:
      A new BooleanExpression representing the array contains comparison.
    • arrayContains

      @BetaApi public static BooleanExpression arrayContains(Expression array, Object element)
      Creates an expression that checks if an array contains a specified element.
      Parameters:
      array - The expression representing the array.
      element - The element to check for.
      Returns:
      A new BooleanExpression representing the array contains comparison.
    • arrayContains

      @BetaApi public static BooleanExpression arrayContains(String arrayFieldName, Object element)
      Creates an expression that checks if an array contains a specified element.
      Parameters:
      arrayFieldName - The field name of the array.
      element - The element to check for.
      Returns:
      A new BooleanExpression representing the array contains comparison.
    • arrayContainsAll

      @BetaApi public static BooleanExpression arrayContainsAll(Expression array, List<Object> values)
      Creates an expression that checks if an array contains all of the provided values.
      Parameters:
      array - The expression representing the array.
      values - The values to check for.
      Returns:
      A new BooleanExpression representing the array contains all comparison.
    • arrayContainsAll

      @BetaApi public static BooleanExpression arrayContainsAll(Expression array, Expression arrayExpression)
      Creates an expression that checks if an array contains all of the elements of another array.
      Parameters:
      array - The expression representing the array.
      arrayExpression - The expression representing the array of values to check for.
      Returns:
      A new BooleanExpression representing the array contains all comparison.
    • arrayContainsAll

      @BetaApi public static BooleanExpression arrayContainsAll(String arrayFieldName, List<Object> values)
      Creates an expression that checks if an array contains all of the provided values.
      Parameters:
      arrayFieldName - The field name of the array.
      values - The values to check for.
      Returns:
      A new BooleanExpression representing the array contains all comparison.
    • arrayContainsAll

      @BetaApi public static BooleanExpression arrayContainsAll(String arrayFieldName, Expression arrayExpression)
      Creates an expression that checks if an array contains all of the elements of another array.
      Parameters:
      arrayFieldName - The field name of the array.
      arrayExpression - The expression representing the array of values to check for.
      Returns:
      A new BooleanExpression representing the array contains all comparison.
    • arrayContainsAny

      @BetaApi public static BooleanExpression arrayContainsAny(Expression array, List<Object> values)
      Creates an expression that checks if an array contains any of the provided values.
      Parameters:
      array - The expression representing the array.
      values - The values to check for.
      Returns:
      A new BooleanExpression representing the array contains any comparison.
    • arrayContainsAny

      @BetaApi public static BooleanExpression arrayContainsAny(Expression array, Expression arrayExpression)
      Creates an expression that checks if an array contains any of the elements of another array.
      Parameters:
      array - The expression representing the array.
      arrayExpression - The expression representing the array of values to check for.
      Returns:
      A new BooleanExpression representing the array contains any comparison.
    • arrayContainsAny

      @BetaApi public static BooleanExpression arrayContainsAny(String arrayFieldName, List<Object> values)
      Creates an expression that checks if an array contains any of the provided values.
      Parameters:
      arrayFieldName - The field name of the array.
      values - The values to check for.
      Returns:
      A new BooleanExpression representing the array contains any comparison.
    • arrayContainsAny

      @BetaApi public static BooleanExpression arrayContainsAny(String arrayFieldName, Expression arrayExpression)
      Creates an expression that checks if an array contains any of the elements of another array.
      Parameters:
      arrayFieldName - The field name of the array.
      arrayExpression - The expression representing the array of values to check for.
      Returns:
      A new BooleanExpression representing the array contains any comparison.
    • arrayLength

      @BetaApi public static Expression arrayLength(Expression array)
      Creates an expression that returns the length of an array.
      Parameters:
      array - The expression representing the array.
      Returns:
      A new Expression representing the length of the array.
    • arrayLength

      @BetaApi public static Expression arrayLength(String arrayFieldName)
      Creates an expression that returns the length of an array.
      Parameters:
      arrayFieldName - The field name of the array.
      Returns:
      A new Expression representing the length of the array.
    • arrayFirst

      @BetaApi public static Expression arrayFirst(Expression array)
      Creates an expression that returns the first element of an array.
      Parameters:
      array - The expression representing the array.
      Returns:
      A new Expression representing the first element of the array.
    • arrayFirst

      @BetaApi public static Expression arrayFirst(String arrayFieldName)
      Creates an expression that returns the first element of an array.
      Parameters:
      arrayFieldName - The field name of the array.
      Returns:
      A new Expression representing the first element of the array.
    • arrayFirstN

      @BetaApi public static Expression arrayFirstN(Expression array, Expression n)
      Creates an expression that returns the first n elements of an array.
      Parameters:
      array - The expression representing the array.
      n - The Expression evaluates to the number of elements to return.
      Returns:
      A new Expression representing the first n elements of the array.
    • arrayFirstN

      @BetaApi public static Expression arrayFirstN(Expression array, int n)
      Creates an expression that returns the first n elements of an array.
      Parameters:
      array - The expression representing the array.
      n - The number of elements to return.
      Returns:
      A new Expression representing the first n elements of the array.
    • arrayFirstN

      @BetaApi public static Expression arrayFirstN(String arrayFieldName, int n)
      Creates an expression that returns the first n elements of an array.
      Parameters:
      arrayFieldName - The field name of the array.
      n - The number of elements to return.
      Returns:
      A new Expression representing the first n elements of the array.
    • arrayFirstN

      @BetaApi public static Expression arrayFirstN(String arrayFieldName, Expression n)
      Creates an expression that returns the first n elements of an array.
      Parameters:
      arrayFieldName - The field name of the array.
      n - The Expression evaluates to the number of elements to return.
      Returns:
      A new Expression representing the first n elements of the array.
    • arrayLast

      @BetaApi public static Expression arrayLast(Expression array)
      Creates an expression that returns the last element of an array.
      Parameters:
      array - The expression representing the array.
      Returns:
      A new Expression representing the last element of the array.
    • arrayLast

      @BetaApi public static Expression arrayLast(String arrayFieldName)
      Creates an expression that returns the last element of an array.
      Parameters:
      arrayFieldName - The field name of the array.
      Returns:
      A new Expression representing the last element of the array.
    • arrayLastN

      @BetaApi public static Expression arrayLastN(Expression array, Expression n)
      Creates an expression that returns the last n elements of an array.
      Parameters:
      array - The expression representing the array.
      n - The Expression evaluates to the number of elements to return.
      Returns:
      A new Expression representing the last n elements of the array.
    • arrayLastN

      @BetaApi public static Expression arrayLastN(Expression array, int n)
      Creates an expression that returns the last n elements of an array.
      Parameters:
      array - The expression representing the array.
      n - The number of elements to return.
      Returns:
      A new Expression representing the last n elements of the array.
    • arrayLastN

      @BetaApi public static Expression arrayLastN(String arrayFieldName, int n)
      Creates an expression that returns the last n elements of an array.
      Parameters:
      arrayFieldName - The field name of the array.
      n - The number of elements to return.
      Returns:
      A new Expression representing the last n elements of the array.
    • arrayLastN

      @BetaApi public static Expression arrayLastN(String arrayFieldName, Expression n)
      Creates an expression that returns the last n elements of an array.
      Parameters:
      arrayFieldName - The field name of the array.
      n - The Expression evaluates to the number of elements to return.
      Returns:
      A new Expression representing the last n elements of the array.
    • arrayMinimum

      @BetaApi public static Expression arrayMinimum(Expression array)
      Creates an expression that returns the minimum value of an array.
      Parameters:
      array - The expression representing the array.
      Returns:
      A new Expression representing the minimum value of the array.
    • arrayMinimum

      @BetaApi public static Expression arrayMinimum(String arrayFieldName)
      Creates an expression that returns the minimum value of an array.
      Parameters:
      arrayFieldName - The field name of the array.
      Returns:
      A new Expression representing the minimum value of the array.
    • arrayMinimumN

      @BetaApi public static Expression arrayMinimumN(Expression array, Expression n)
      Creates an expression that returns the n minimum values of an 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.

      Parameters:
      array - The expression representing the array.
      n - The Expression evaluates to the number of elements to return.
      Returns:
      A new Expression representing the n minimum values of the array.
    • arrayMinimumN

      @BetaApi public static Expression arrayMinimumN(Expression array, int n)
      Creates an expression that returns the n minimum values of an 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.

      Parameters:
      array - The expression representing the array.
      n - The number of elements to return.
      Returns:
      A new Expression representing the n minimum values of the array.
    • arrayMinimumN

      @BetaApi public static Expression arrayMinimumN(String arrayFieldName, int n)
      Creates an expression that returns the n minimum values of an 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.

      Parameters:
      arrayFieldName - The field name of the array.
      n - The number of elements to return.
      Returns:
      A new Expression representing the n minimum values of the array.
    • arrayMinimumN

      @BetaApi public static Expression arrayMinimumN(String arrayFieldName, Expression n)
      Creates an expression that returns the n minimum values of an 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.

      Parameters:
      arrayFieldName - The field name of the array.
      n - The Expression evaluates to the number of elements to return.
      Returns:
      A new Expression representing the n minimum values of the array.
    • arrayMaximum

      @BetaApi public static Expression arrayMaximum(Expression array)
      Creates an expression that returns the maximum value of an array.
      Parameters:
      array - The expression representing the array.
      Returns:
      A new Expression representing the maximum value of the array.
    • arrayMaximum

      @BetaApi public static Expression arrayMaximum(String arrayFieldName)
      Creates an expression that returns the maximum value of an array.
      Parameters:
      arrayFieldName - The field name of the array.
      Returns:
      A new Expression representing the maximum value of the array.
    • arrayMaximumN

      @BetaApi public static Expression arrayMaximumN(Expression array, Expression n)
      Creates an expression that returns the n maximum values of an 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.

      Parameters:
      array - The expression representing the array.
      n - The Expression evaluates to the number of elements to return.
      Returns:
      A new Expression representing the n maximum values of the array.
    • arrayMaximumN

      @BetaApi public static Expression arrayMaximumN(Expression array, int n)
      Creates an expression that returns the n maximum values of an 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.

      Parameters:
      array - The expression representing the array.
      n - The number of elements to return.
      Returns:
      A new Expression representing the n maximum values of the array.
    • arrayMaximumN

      @BetaApi public static Expression arrayMaximumN(String arrayFieldName, int n)
      Creates an expression that returns the n maximum values of an 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.

      Parameters:
      arrayFieldName - The field name of the array.
      n - The number of elements to return.
      Returns:
      A new Expression representing the n maximum values of the array.
    • arrayMaximumN

      @BetaApi public static Expression arrayMaximumN(String arrayFieldName, Expression n)
      Creates an expression that returns the n maximum values of an 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.

      Parameters:
      arrayFieldName - The field name of the array.
      n - The Expression evaluates to the number of elements to return.
      Returns:
      A new Expression representing the n maximum values of the array.
    • arrayIndexOf

      @BetaApi public static Expression arrayIndexOf(Expression array, Expression value)
      Creates an expression that returns the index of the first occurrence of a value in an array.
      Parameters:
      array - The expression representing the array.
      value - The value to search for.
      Returns:
      A new Expression representing the index.
    • arrayIndexOf

      @BetaApi public static Expression arrayIndexOf(Expression array, Object value)
      Creates an expression that returns the index of the first occurrence of a value in an array.
      Parameters:
      array - The expression representing the array.
      value - The value to search for.
      Returns:
      A new Expression representing the index.
    • arrayIndexOf

      @BetaApi public static Expression arrayIndexOf(String arrayFieldName, Object value)
      Creates an expression that returns the index of the first occurrence of a value in an array.
      Parameters:
      arrayFieldName - The field name of the array.
      value - The value to search for.
      Returns:
      A new Expression representing the index.
    • arrayIndexOf

      @BetaApi public static Expression arrayIndexOf(String arrayFieldName, Expression value)
      Creates an expression that returns the index of the first occurrence of a value in an array.
      Parameters:
      arrayFieldName - The field name of the array.
      value - The value to search for.
      Returns:
      A new Expression representing the index.
    • arrayLastIndexOf

      @BetaApi public static Expression arrayLastIndexOf(Expression array, Expression value)
      Creates an expression that returns the index of the last occurrence of a value in an array.
      Parameters:
      array - The expression representing the array.
      value - The value to search for.
      Returns:
      A new Expression representing the last index.
    • arrayLastIndexOf

      @BetaApi public static Expression arrayLastIndexOf(Expression array, Object value)
      Creates an expression that returns the index of the last occurrence of a value in an array.
      Parameters:
      array - The expression representing the array.
      value - The value to search for.
      Returns:
      A new Expression representing the last index.
    • arrayLastIndexOf

      @BetaApi public static Expression arrayLastIndexOf(String arrayFieldName, Object value)
      Creates an expression that returns the index of the last occurrence of a value in an array.
      Parameters:
      arrayFieldName - The field name of the array.
      value - The value to search for.
      Returns:
      A new Expression representing the last index.
    • arrayLastIndexOf

      @BetaApi public static Expression arrayLastIndexOf(String arrayFieldName, Expression value)
      Creates an expression that returns the index of the last occurrence of a value in an array.
      Parameters:
      arrayFieldName - The field name of the array.
      value - The value to search for.
      Returns:
      A new Expression representing the last index.
    • arrayIndexOfAll

      @BetaApi public static Expression arrayIndexOfAll(Expression array, Expression value)
      Creates an expression that returns all indices of a value in an array.
      Parameters:
      array - The expression representing the array.
      value - The value to search for.
      Returns:
      A new Expression representing the indices.
    • arrayIndexOfAll

      @BetaApi public static Expression arrayIndexOfAll(Expression array, Object value)
      Creates an expression that returns all indices of a value in an array.
      Parameters:
      array - The expression representing the array.
      value - The value to search for.
      Returns:
      A new Expression representing the indices.
    • arrayIndexOfAll

      @BetaApi public static Expression arrayIndexOfAll(String arrayFieldName, Object value)
      Creates an expression that returns all indices of a value in an array.
      Parameters:
      arrayFieldName - The field name of the array.
      value - The value to search for.
      Returns:
      A new Expression representing the indices.
    • arrayIndexOfAll

      @BetaApi public static Expression arrayIndexOfAll(String arrayFieldName, Expression value)
      Creates an expression that returns all indices of a value in an array.
      Parameters:
      arrayFieldName - The field name of the array.
      value - The value to search for.
      Returns:
      A new Expression representing the indices.
    • arrayGet

      @BetaApi public static Expression arrayGet(Expression array, Expression offset)
      Creates an expression that returns an element from an array at a specified index.
      Parameters:
      array - The expression representing the array.
      offset - The index of the element to return.
      Returns:
      A new Expression representing the element at the specified index.
    • arrayGet

      @BetaApi public static Expression arrayGet(Expression array, int offset)
      Creates an expression that returns an element from an array at a specified index.
      Parameters:
      array - The expression representing the array.
      offset - The index of the element to return.
      Returns:
      A new Expression representing the element at the specified index.
    • arrayGet

      @BetaApi public static Expression arrayGet(String arrayFieldName, Expression offset)
      Creates an expression that returns an element from an array at a specified index.
      Parameters:
      arrayFieldName - The field name of the array.
      offset - The index of the element to return.
      Returns:
      A new Expression representing the element at the specified index.
    • arrayGet

      @BetaApi public static Expression arrayGet(String arrayFieldName, int offset)
      Creates an expression that returns an element from an array at a specified index.
      Parameters:
      arrayFieldName - The field name of the array.
      offset - The index of the element to return.
      Returns:
      A new Expression representing the element at the specified index.
    • arraySum

      @BetaApi public static Expression arraySum(Expression array)
      Creates an expression that returns the sum of the elements of an array.
      Parameters:
      array - The expression representing the array.
      Returns:
      A new Expression representing the sum of the elements of the array.
    • arraySum

      @BetaApi public static Expression arraySum(String arrayFieldName)
      Creates an expression that returns the sum of the elements of an array.
      Parameters:
      arrayFieldName - The field name of the array.
      Returns:
      A new Expression representing the sum of the elements of the array.
    • cosineDistance

      @BetaApi public static Expression cosineDistance(Expression vector1, Expression vector2)
      Creates an expression that calculates the cosine distance between two vectors.
      Parameters:
      vector1 - The first vector.
      vector2 - The second vector.
      Returns:
      A new Expression representing the cosine distance.
    • cosineDistance

      @BetaApi public static Expression cosineDistance(Expression vector1, double[] vector2)
      Creates an expression that calculates the cosine distance between two vectors.
      Parameters:
      vector1 - The first vector.
      vector2 - The second vector.
      Returns:
      A new Expression representing the cosine distance.
    • cosineDistance

      @BetaApi public static Expression cosineDistance(String vectorFieldName, Expression vector)
      Creates an expression that calculates the cosine distance between two vectors.
      Parameters:
      vectorFieldName - The field name of the first vector.
      vector - The second vector.
      Returns:
      A new Expression representing the cosine distance.
    • cosineDistance

      @BetaApi public static Expression cosineDistance(String vectorFieldName, double[] vector)
      Creates an expression that calculates the cosine distance between two vectors.
      Parameters:
      vectorFieldName - The field name of the first vector.
      vector - The second vector.
      Returns:
      A new Expression representing the cosine distance.
    • dotProduct

      @BetaApi public static Expression dotProduct(Expression vector1, Expression vector2)
      Creates an expression that calculates the dot product of two vectors.
      Parameters:
      vector1 - The first vector.
      vector2 - The second vector.
      Returns:
      A new Expression representing the dot product.
    • dotProduct

      @BetaApi public static Expression dotProduct(Expression vector1, double[] vector2)
      Creates an expression that calculates the dot product of two vectors.
      Parameters:
      vector1 - The first vector.
      vector2 - The second vector.
      Returns:
      A new Expression representing the dot product.
    • dotProduct

      @BetaApi public static Expression dotProduct(String vectorFieldName, Expression vector)
      Creates an expression that calculates the dot product of two vectors.
      Parameters:
      vectorFieldName - The field name of the first vector.
      vector - The second vector.
      Returns:
      A new Expression representing the dot product.
    • dotProduct

      @BetaApi public static Expression dotProduct(String vectorFieldName, double[] vector)
      Creates an expression that calculates the dot product of two vectors.
      Parameters:
      vectorFieldName - The field name of the first vector.
      vector - The second vector.
      Returns:
      A new Expression representing the dot product.
    • euclideanDistance

      @BetaApi public static Expression euclideanDistance(Expression vector1, Expression vector2)
      Creates an expression that calculates the Euclidean distance between two vectors.
      Parameters:
      vector1 - The first vector.
      vector2 - The second vector.
      Returns:
      A new Expression representing the Euclidean distance.
    • euclideanDistance

      @BetaApi public static Expression euclideanDistance(Expression vector1, double[] vector2)
      Creates an expression that calculates the Euclidean distance between two vectors.
      Parameters:
      vector1 - The first vector.
      vector2 - The second vector.
      Returns:
      A new Expression representing the Euclidean distance.
    • euclideanDistance

      @BetaApi public static Expression euclideanDistance(String vectorFieldName, Expression vector)
      Creates an expression that calculates the Euclidean distance between two vectors.
      Parameters:
      vectorFieldName - The field name of the first vector.
      vector - The second vector.
      Returns:
      A new Expression representing the Euclidean distance.
    • euclideanDistance

      @BetaApi public static Expression euclideanDistance(String vectorFieldName, double[] vector)
      Creates an expression that calculates the Euclidean distance between two vectors.
      Parameters:
      vectorFieldName - The field name of the first vector.
      vector - The second vector.
      Returns:
      A new Expression representing the Euclidean distance.
    • vectorLength

      @BetaApi public static Expression vectorLength(Expression vectorExpression)
      Creates an expression that calculates the length of a vector.
      Parameters:
      vectorExpression - The expression representing the vector.
      Returns:
      A new Expression representing the length of the vector.
    • vectorLength

      @BetaApi public static Expression vectorLength(String fieldName)
      Creates an expression that calculates the length of a vector.
      Parameters:
      fieldName - The field name of the vector.
      Returns:
      A new Expression representing the length of the vector.
    • unixMicrosToTimestamp

      @BetaApi public static Expression unixMicrosToTimestamp(Expression expr)
      Creates an expression that converts a Unix timestamp in microseconds to a Firestore timestamp.
      Parameters:
      expr - The expression representing the Unix timestamp in microseconds.
      Returns:
      A new Expression representing the Firestore timestamp.
    • unixMicrosToTimestamp

      @BetaApi public static Expression unixMicrosToTimestamp(String fieldName)
      Creates an expression that interprets a field's value as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
      Parameters:
      fieldName - The name of the field containing the number of microseconds since epoch.
      Returns:
      A new Expression representing the timestamp.
    • timestampToUnixMicros

      @BetaApi public static Expression timestampToUnixMicros(Expression expr)
      Creates an expression that converts a timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
      Parameters:
      expr - The expression representing the timestamp.
      Returns:
      A new Expression representing the number of microseconds since epoch.
    • timestampToUnixMicros

      @BetaApi public static Expression timestampToUnixMicros(String fieldName)
      Creates an expression that converts a timestamp field to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
      Parameters:
      fieldName - The name of the field that contains the timestamp.
      Returns:
      A new Expression representing the number of microseconds since epoch.
    • unixMillisToTimestamp

      @BetaApi public static Expression unixMillisToTimestamp(Expression expr)
      Creates an expression that interprets an expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
      Parameters:
      expr - The expression representing the number of milliseconds since epoch.
      Returns:
      A new Expression representing the timestamp.
    • unixMillisToTimestamp

      @BetaApi public static Expression unixMillisToTimestamp(String fieldName)
      Creates an expression that interprets a field's value as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
      Parameters:
      fieldName - The name of the field containing the number of milliseconds since epoch.
      Returns:
      A new Expression representing the timestamp.
    • timestampToUnixMillis

      @BetaApi public static Expression timestampToUnixMillis(Expression expr)
      Creates an expression that converts a timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
      Parameters:
      expr - The expression representing the timestamp.
      Returns:
      A new Expression representing the number of milliseconds since epoch.
    • timestampToUnixMillis

      @BetaApi public static Expression timestampToUnixMillis(String fieldName)
      Creates an expression that converts a timestamp field to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
      Parameters:
      fieldName - The name of the field that contains the timestamp.
      Returns:
      A new Expression representing the number of milliseconds since epoch.
    • unixSecondsToTimestamp

      @BetaApi public static Expression unixSecondsToTimestamp(Expression expr)
      Creates an expression that interprets an expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
      Parameters:
      expr - The expression representing the number of seconds since epoch.
      Returns:
      A new Expression representing the timestamp.
    • unixSecondsToTimestamp

      @BetaApi public static Expression unixSecondsToTimestamp(String fieldName)
      Creates an expression that interprets a field's value as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
      Parameters:
      fieldName - The name of the field containing the number of seconds since epoch.
      Returns:
      A new Expression representing the timestamp.
    • timestampToUnixSeconds

      @BetaApi public static Expression timestampToUnixSeconds(Expression expr)
      Creates an expression that converts a timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC).
      Parameters:
      expr - The expression representing the timestamp.
      Returns:
      A new Expression representing the number of seconds since epoch.
    • timestampToUnixSeconds

      @BetaApi public static Expression timestampToUnixSeconds(String fieldName)
      Creates an expression that converts a timestamp field to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC).
      Parameters:
      fieldName - The name of the field that contains the timestamp.
      Returns:
      A new Expression representing the number of seconds since epoch.
    • timestampAdd

      @BetaApi public static Expression timestampAdd(Expression timestamp, Expression unit, Expression amount)
      Creates an expression that adds a specified amount of time to a timestamp.
      Parameters:
      timestamp - The expression representing the timestamp.
      unit - The expression representing the unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day".
      amount - The expression representing the amount of time to add.
      Returns:
      A new Expression representing the resulting timestamp.
    • timestampAdd

      @BetaApi public static Expression timestampAdd(Expression timestamp, String unit, long amount)
      Creates an expression that adds a specified amount of time to a timestamp.
      Parameters:
      timestamp - The expression representing the timestamp.
      unit - The unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day".
      amount - The amount of time to add.
      Returns:
      A new Expression representing the resulting timestamp.
    • timestampAdd

      @BetaApi public static Expression timestampAdd(String fieldName, Expression unit, Expression amount)
      Creates an expression that adds a specified amount of time to a timestamp.
      Parameters:
      fieldName - The name of the field that contains the timestamp.
      unit - The expression representing the unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day".
      amount - The expression representing the amount of time to add.
      Returns:
      A new Expression representing the resulting timestamp.
    • timestampAdd

      @BetaApi public static Expression timestampAdd(String fieldName, String unit, long amount)
      Creates an expression that adds a specified amount of time to a timestamp.
      Parameters:
      fieldName - The name of the field that contains the timestamp.
      unit - The unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day".
      amount - The amount of time to add.
      Returns:
      A new Expression representing the resulting timestamp.
    • timestampSubtract

      @BetaApi public static Expression timestampSubtract(Expression timestamp, Expression unit, Expression amount)
      Creates an expression that subtracts a specified amount of time to a timestamp.
      Parameters:
      timestamp - The expression representing the timestamp.
      unit - The expression representing the unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day".
      amount - The expression representing the amount of time to subtract.
      Returns:
      A new Expression representing the resulting timestamp.
    • timestampSubtract

      @BetaApi public static Expression timestampSubtract(Expression timestamp, String unit, long amount)
      Creates an expression that subtracts a specified amount of time to a timestamp.
      Parameters:
      timestamp - The expression representing the timestamp.
      unit - The unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day".
      amount - The amount of time to subtract.
      Returns:
      A new Expression representing the resulting timestamp.
    • timestampSubtract

      @BetaApi public static Expression timestampSubtract(String fieldName, Expression unit, Expression amount)
      Creates an expression that subtracts a specified amount of time to a timestamp.
      Parameters:
      fieldName - The name of the field that contains the timestamp.
      unit - The unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day".
      amount - The amount of time to subtract.
      Returns:
      A new Expression representing the resulting timestamp.
    • timestampSubtract

      @BetaApi public static Expression timestampSubtract(String fieldName, String unit, long amount)
      Creates an expression that subtracts a specified amount of time to a timestamp.
      Parameters:
      fieldName - The name of the field that contains the timestamp.
      unit - The unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day".
      amount - The amount of time to subtract.
      Returns:
      A new Expression representing the resulting timestamp.
    • timestampTruncate

      @BetaApi public static Expression timestampTruncate(Expression timestamp, String granularity)
      Creates an expression that truncates a timestamp to a specified granularity.
      Parameters:
      timestamp - The timestamp expression.
      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:
      A new Expression representing the truncated timestamp.
    • timestampTruncate

      @BetaApi public static Expression timestampTruncate(Expression timestamp, Expression granularity)
      Creates an expression that truncates a timestamp to a specified granularity.
      Parameters:
      timestamp - The timestamp 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:
      A new Expression representing the truncated timestamp.
    • timestampTruncate

      @BetaApi public static Expression timestampTruncate(String fieldName, String granularity)
      Creates an expression that truncates a timestamp to a specified granularity.
      Parameters:
      fieldName - The name of the field containing the timestamp.
      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:
      A new Expression representing the truncated timestamp.
    • timestampTruncate

      @BetaApi public static Expression timestampTruncate(String fieldName, Expression granularity)
      Creates an expression that truncates a timestamp to a specified granularity.
      Parameters:
      fieldName - The name of the field containing the timestamp.
      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:
      A new Expression representing the truncated timestamp.
    • timestampTruncate

      @BetaApi public static Expression timestampTruncate(Expression timestamp, String granularity, String timezone)
      Creates an expression that truncates a timestamp to a specified granularity in a given timezone.
      Parameters:
      timestamp - The timestamp expression.
      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".
      timezone - The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1".
      Returns:
      A new Expression representing the truncated timestamp.
    • timestampTruncate

      @BetaApi public static Expression timestampTruncate(Expression timestamp, Expression granularity, String timezone)
      Creates an expression that truncates a timestamp to a specified granularity in a given timezone.
      Parameters:
      timestamp - The timestamp 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".
      timezone - The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1".
      Returns:
      A new Expression representing the truncated timestamp.
    • timestampTruncate

      @BetaApi public static Expression timestampTruncate(String fieldName, String granularity, String timezone)
      Creates an expression that truncates a timestamp to a specified granularity in a given timezone.
      Parameters:
      fieldName - The name of the field containing the timestamp.
      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".
      timezone - The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1".
      Returns:
      A new Expression representing the truncated timestamp.
    • timestampTruncate

      @BetaApi public static Expression timestampTruncate(String fieldName, Expression granularity, String timezone)
      Creates an expression that truncates a timestamp to a specified granularity in a given timezone.
      Parameters:
      fieldName - The name of the field containing the timestamp.
      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".
      timezone - The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1".
      Returns:
      A new Expression representing the truncated timestamp.
    • conditional

      @BetaApi public static Expression conditional(BooleanExpression condition, Expression thenExpr, Expression elseExpr)
      Creates a conditional expression that evaluates to a thenExpr expression if a condition is true or an elseExpr expression if the condition is false.
      Parameters:
      condition - The condition to evaluate.
      thenExpr - The expression to evaluate if the condition is true.
      elseExpr - The expression to evaluate if the condition is false.
      Returns:
      A new Expression representing the conditional operation.
    • conditional

      @BetaApi public static Expression conditional(BooleanExpression condition, Object thenValue, Object elseValue)
      Creates a conditional expression that evaluates to a thenValue if a condition is true or an elseValue if the condition is false.
      Parameters:
      condition - The condition to evaluate.
      thenValue - Value if the condition is true.
      elseValue - Value if the condition is false.
      Returns:
      A new Expression representing the conditional operation.
    • ifError

      @BetaApi public static Expression ifError(Expression tryExpr, Expression catchExpr)
      Creates an expression that returns the catchExpr argument if there is an error, else return the result of the tryExpr argument evaluation.
      Parameters:
      tryExpr - The try expression.
      catchExpr - The catch expression that will be evaluated and returned if the tryExpr produces an error.
      Returns:
      A new Expression representing the ifError operation.
    • ifError

      @BetaApi public static BooleanExpression ifError(BooleanExpression tryExpr, BooleanExpression catchExpr)
      Creates an expression that returns the catchExpr argument if there is an error, else return the result of the tryExpr argument evaluation.

      This overload will return BooleanExpression when both parameters are also BooleanExpression.

      Parameters:
      tryExpr - The try boolean expression.
      catchExpr - The catch boolean expression that will be evaluated and returned if the tryExpr produces an error.
      Returns:
      A new BooleanExpression representing the ifError operation.
    • ifError

      @BetaApi public static Expression ifError(Expression tryExpr, Object catchValue)
      Creates an expression that returns the catchValue argument if there is an error, else return the result of the tryExpr argument evaluation.
      Parameters:
      tryExpr - The try expression.
      catchValue - The value that will be returned if the tryExpr produces an error.
      Returns:
      A new Expression representing the ifError operation.
    • isError

      @BetaApi public static BooleanExpression isError(Expression expr)
      Creates an expression that checks if a given expression produces an error.
      Parameters:
      expr - The expression to check.
      Returns:
      A new BooleanExpression representing the `isError` check.
    • documentId

      @BetaApi public static Expression documentId(Expression documentPath)
      Creates an expression that returns the document ID from a path.
      Parameters:
      documentPath - An expression the evaluates to document path.
      Returns:
      A new Expression representing the documentId operation.
    • documentId

      @BetaApi public static Expression documentId(String documentPath)
      Creates an expression that returns the document ID from a path.
      Parameters:
      documentPath - The string representation of the document path.
      Returns:
      A new Expression representing the documentId operation.
    • documentId

      @BetaApi public static Expression documentId(DocumentReference docRef)
      Creates an expression that returns the document ID from a DocumentReference.
      Parameters:
      docRef - The DocumentReference.
      Returns:
      A new Expression representing the documentId operation.
    • collectionId

      @BetaApi public static Expression collectionId(Expression path)
      Creates an expression that returns the collection ID from a path.
      Parameters:
      path - An expression the evaluates to document path.
      Returns:
      A new Expression representing the collectionId operation.
    • collectionId

      @BetaApi public static Expression collectionId(String pathFieldName)
      Creates an expression that returns the collection ID from a path.
      Parameters:
      pathFieldName - The field name of the path.
      Returns:
      A new Expression representing the collectionId operation.
    • exists

      @BetaApi public static BooleanExpression exists(Expression value)
      Creates an expression that checks if a field exists.
      Parameters:
      value - An expression evaluates to the name of the field to check.
      Returns:
      A new Expression representing the exists check.
    • exists

      @BetaApi public static BooleanExpression exists(String fieldName)
      Creates an expression that checks if a field exists.
      Parameters:
      fieldName - The field name to check.
      Returns:
      A new Expression representing the exists check.
    • isAbsent

      @BetaApi public static BooleanExpression isAbsent(Expression value)
      Creates an expression that returns true if a value is absent. Otherwise, returns false even if the value is null.
      Parameters:
      value - The expression to check.
      Returns:
      A new BooleanExpression representing the isAbsent operation.
    • isAbsent

      @BetaApi public static BooleanExpression isAbsent(String fieldName)
      Creates an expression that returns true if a field is absent. Otherwise, returns false even if the field value is null.
      Parameters:
      fieldName - The field to check.
      Returns:
      A new BooleanExpression representing the isAbsent operation.
    • type

      @BetaApi public static Expression type(Expression expr)
      Creates an expression that returns a string indicating the type of the value this expression evaluates to.
      Parameters:
      expr - The expression to get the type of.
      Returns:
      A new Expression representing the type operation.
    • type

      @BetaApi public static Expression type(String fieldName)
      Creates an expression that returns a string indicating the type of the value this field evaluates to.
      Parameters:
      fieldName - The name of the field to get the type of.
      Returns:
      A new Expression representing the type operation.
    • round

      @BetaApi public static Expression round(Expression numericExpr)
      Creates an expression that rounds numericExpr to nearest integer.

      Rounds away from zero in halfway cases.

      Parameters:
      numericExpr - An expression that returns number when evaluated.
      Returns:
      A new Expression representing an integer result from the round operation.
    • round

      @BetaApi public static Expression round(String numericField)
      Creates an expression that rounds numericField to nearest integer.

      Rounds away from zero in halfway cases.

      Parameters:
      numericField - Name of field that returns number when evaluated.
      Returns:
      A new Expression representing an integer result from the round operation.
    • roundToPrecision

      @BetaApi public static Expression roundToPrecision(Expression numericExpr, int decimalPlace)
      Creates an expression that rounds off numericExpr to decimalPlace decimal places if decimalPlace is positive, rounds off digits to the left of the decimal point if decimalPlace is negative. Rounds away from zero in halfway cases.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      decimalPlace - The number of decimal places to round.
      Returns:
      A new Expression representing the round operation.
    • roundToPrecision

      @BetaApi public static Expression roundToPrecision(String numericField, int decimalPlace)
      Creates an expression that rounds off numericField to decimalPlace decimal places if decimalPlace is positive, rounds off digits to the left of the decimal point if decimalPlace is negative. Rounds away from zero in halfway cases.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      decimalPlace - The number of decimal places to round.
      Returns:
      A new Expression representing the round operation.
    • roundToPrecision

      @BetaApi public static Expression roundToPrecision(Expression numericExpr, Expression decimalPlace)
      Creates an expression that rounds off numericExpr to decimalPlace decimal places if decimalPlace is positive, rounds off digits to the left of the decimal point if decimalPlace is negative. Rounds away from zero in halfway cases.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      decimalPlace - The number of decimal places to round.
      Returns:
      A new Expression representing the round operation.
    • roundToPrecision

      @BetaApi public static Expression roundToPrecision(String numericField, Expression decimalPlace)
      Creates an expression that rounds off numericField to decimalPlace decimal places if decimalPlace is positive, rounds off digits to the left of the decimal point if decimalPlace is negative. Rounds away from zero in halfway cases.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      decimalPlace - The number of decimal places to round.
      Returns:
      A new Expression representing the round operation.
    • rand

      @BetaApi public static Expression rand()
      Creates an expression that returns a random double between 0.0 and 1.0 but not including 1.0.
      Returns:
      A new Expression representing a random double result from the rand operation.
    • trunc

      @BetaApi public static Expression trunc(Expression numericExpr)
      Creates an expression that truncates numericExpr to an integer.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      Returns:
      A new Expression representing the trunc operation.
    • trunc

      @BetaApi public static Expression trunc(String numericField)
      Creates an expression that truncates numericField to an integer.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      Returns:
      A new Expression representing the trunc operation.
    • truncToPrecision

      @BetaApi public static Expression truncToPrecision(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.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      decimalPlace - The number of decimal places to truncate.
      Returns:
      A new Expression representing the trunc operation.
    • truncToPrecision

      @BetaApi public static Expression truncToPrecision(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.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      decimalPlace - The number of decimal places to truncate.
      Returns:
      A new Expression representing the trunc operation.
    • truncToPrecision

      @BetaApi public static Expression truncToPrecision(Expression numericExpr, 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.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      decimalPlace - The number of decimal places to truncate.
      Returns:
      A new Expression representing the trunc operation.
    • truncToPrecision

      @BetaApi public static Expression truncToPrecision(String numericField, 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.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      decimalPlace - The number of decimal places to truncate.
      Returns:
      A new Expression representing the trunc operation.
    • ceil

      @BetaApi public static Expression ceil(Expression numericExpr)
      Creates an expression that returns the smallest integer that isn't less than numericExpr.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      Returns:
      A new Expression representing an integer result from the ceil operation.
    • ceil

      @BetaApi public static Expression ceil(String numericField)
      Creates an expression that returns the smallest integer that isn't less than numericField.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      Returns:
      A new Expression representing an integer result from the ceil operation.
    • floor

      @BetaApi public static Expression floor(Expression numericExpr)
      Creates an expression that returns the largest integer that isn't less than numericExpr.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      Returns:
      A new Expression representing an integer result from the floor operation.
    • floor

      @BetaApi public static Expression floor(String numericField)
      Creates an expression that returns the largest integer that isn't less than numericField.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      Returns:
      A new Expression representing an integer result from the floor operation.
    • pow

      @BetaApi public static Expression pow(Expression numericExpr, Number exponent)
      Creates an expression that returns the numericExpr raised to the power of the exponent. Returns infinity on overflow and zero on underflow.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      exponent - The numeric power to raise the numericExpr.
      Returns:
      A new Expression representing a numeric result from raising numericExpr to the power of exponent.
    • pow

      @BetaApi public static Expression pow(String numericField, Number exponent)
      Creates an expression that returns the numericField raised to the power of the exponent. Returns infinity on overflow and zero on underflow.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      exponent - The numeric power to raise the numericField.
      Returns:
      A new Expression representing a numeric result from raising numericField to the power of exponent.
    • pow

      @BetaApi public static Expression pow(Expression numericExpr, Expression exponent)
      Creates an expression that returns the numericExpr raised to the power of the exponent. Returns infinity on overflow and zero on underflow.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      exponent - The numeric power to raise the numericExpr.
      Returns:
      A new Expression representing a numeric result from raising numericExpr to the power of exponent.
    • pow

      @BetaApi public static Expression pow(String numericField, Expression exponent)
      Creates an expression that returns the numericField raised to the power of the exponent. Returns infinity on overflow and zero on underflow.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      exponent - The numeric power to raise the numericField.
      Returns:
      A new Expression representing a numeric result from raising numericField to the power of exponent.
    • abs

      @BetaApi public static Expression abs(Expression numericExpr)
      Creates an expression that returns the absolute value of numericExpr.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      Returns:
      A new Expression representing the numeric result of the absolute value operation.
    • abs

      @BetaApi public static Expression abs(String numericField)
      Creates an expression that returns the absolute value of numericField.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      Returns:
      A new Expression representing the numeric result of the absolute value operation.
    • exp

      @BetaApi public static Expression exp(Expression numericExpr)
      Creates an expression that returns Euler's number e raised to the power of numericExpr.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      Returns:
      A new Expression representing the numeric result of the exponentiation.
    • exp

      @BetaApi public static Expression exp(String numericField)
      Creates an expression that returns Euler's number e raised to the power of numericField.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      Returns:
      A new Expression representing the numeric result of the exponentiation.
    • ln

      @BetaApi public static Expression ln(Expression numericExpr)
      Creates an expression that returns the natural logarithm (base e) of numericExpr.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      Returns:
      A new Expression representing the numeric result of the natural logarithm.
    • ln

      @BetaApi public static Expression ln(String numericField)
      Creates an expression that returns the natural logarithm (base e) of numericField.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      Returns:
      A new Expression representing the numeric result of the natural logarithm.
    • log

      @BetaApi public static Expression log(Expression numericExpr, Number base)
      Creates an expression that returns the logarithm of numericExpr with a given base.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      base - The base of the logarithm.
      Returns:
      A new Expression representing a numeric result from the logarithm of numericExpr with a given base.
    • log

      @BetaApi public static Expression log(String numericField, Number base)
      Creates an expression that returns the logarithm of numericField with a given base.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      base - The base of the logarithm.
      Returns:
      A new Expression representing a numeric result from the logarithm of numericField with a given base.
    • log

      @BetaApi public static Expression log(Expression numericExpr, Expression base)
      Creates an expression that returns the logarithm of numericExpr with a given base.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      base - The base of the logarithm.
      Returns:
      A new Expression representing a numeric result from the logarithm of numericExpr with a given base.
    • log

      @BetaApi public static Expression log(String numericField, Expression base)
      Creates an expression that returns the logarithm of numericField with a given base.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      base - The base of the logarithm.
      Returns:
      A new Expression representing a numeric result from the logarithm of numericField with a given base.
    • log10

      @BetaApi public static Expression log10(Expression numericExpr)
      Creates an expression that returns the base 10 logarithm of numericExpr.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      Returns:
      A new Expression representing the numeric result of the base 10 logarithm.
    • log10

      @BetaApi public static Expression log10(String numericField)
      Creates an expression that returns the base 10 logarithm of numericField.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      Returns:
      A new Expression representing the numeric result of the base 10 logarithm.
    • sqrt

      @BetaApi public static Expression sqrt(Expression numericExpr)
      Creates an expression that returns the square root of numericExpr.
      Parameters:
      numericExpr - An expression that returns number when evaluated.
      Returns:
      A new Expression representing the numeric result of the square root operation.
    • sqrt

      @BetaApi public static Expression sqrt(String numericField)
      Creates an expression that returns the square root of numericField.
      Parameters:
      numericField - Name of field that returns number when evaluated.
      Returns:
      A new Expression representing the numeric result of the square root operation.
    • isNotNaN

      @BetaApi public static BooleanExpression isNotNaN(Expression expr)
      Creates an expression that checks if the results of expr is NOT 'NaN' (Not a Number).
      Parameters:
      expr - The expression to check.
      Returns:
      A new BooleanExpression representing the isNotNan operation.
    • isNotNaN

      @BetaApi public static BooleanExpression isNotNaN(String fieldName)
      Creates an expression that checks if the results of this expression is NOT 'NaN' (Not a Number).
      Parameters:
      fieldName - The field to check.
      Returns:
      A new BooleanExpression representing the isNotNan operation.
    • logicalMaximum

      @BetaApi public static Expression logicalMaximum(Expression expr, Object... others)
      Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering.
      Parameters:
      expr - The first operand expression.
      others - Optional additional expressions or literals.
      Returns:
      A new Expression representing the logical maximum operation.
    • logicalMaximum

      @BetaApi public static Expression logicalMaximum(String fieldName, Object... others)
      Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering.
      Parameters:
      fieldName - The first operand field name.
      others - Optional additional expressions or literals.
      Returns:
      A new Expression representing the logical maximum operation.
    • logicalMinimum

      @BetaApi public static Expression logicalMinimum(Expression expr, Object... others)
      Creates an expression that returns the smallest value between multiple input expressions or literal values. Based on Firestore's value type ordering.
      Parameters:
      expr - The first operand expression.
      others - Optional additional expressions or literals.
      Returns:
      A new Expression representing the logical minimum operation.
    • logicalMinimum

      @BetaApi public static Expression logicalMinimum(String fieldName, Object... others)
      Creates an expression that returns the smallest value between multiple input expressions or literal values. Based on Firestore's value type ordering.
      Parameters:
      fieldName - The first operand field name.
      others - Optional additional expressions or literals.
      Returns:
      A new Expression representing the logical minimum operation.
    • concat

      @BetaApi public Expression concat(Object... others)
      Creates an expression that concatenates this expression with other values.
      Parameters:
      others - Optional additional expressions or constants to concatenate.
      Returns:
      A new Expression representing the concatenated value.
    • ifAbsent

      @BetaApi public Expression ifAbsent(Object elseValue)
      Creates an expression that returns a default value if this expression evaluates to an absent value.
      Parameters:
      elseValue - The default value.
      Returns:
      A new Expression representing the ifAbsent operation.
    • join

      @BetaApi public Expression join(String delimiter)
      Creates an expression that joins the elements of this array expression into a string.
      Parameters:
      delimiter - The delimiter to use.
      Returns:
      A new Expression representing the join operation.
    • join

      @BetaApi public Expression join(Expression delimiter)
      Creates an expression that joins the elements of this array expression into a string.
      Parameters:
      delimiter - The delimiter to use.
      Returns:
      A new Expression representing the join operation.
    • isNotNaN

      @BetaApi public final BooleanExpression isNotNaN()
      Creates an expression that checks if the results of this expression is NOT 'NaN' (Not a Number).
      Returns:
      A new BooleanExpression representing the isNotNan operation.
    • logicalMaximum

      @BetaApi public final Expression logicalMaximum(Object... others)
      Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering.
      Parameters:
      others - Optional additional expressions or literals.
      Returns:
      A new Expression representing the logical maximum operation.
    • logicalMinimum

      @BetaApi public final Expression logicalMinimum(Object... others)
      Creates an expression that returns the smallest value between multiple input expressions or literal values. Based on Firestore's value type ordering.
      Parameters:
      others - Optional additional expressions or literals.
      Returns:
      A new Expression representing the logical minimum operation.
    • round

      @BetaApi public final Expression round()
      Creates an expression that rounds this numeric expression to nearest integer.

      Rounds away from zero in halfway cases.

      Returns:
      A new Expression representing an integer result from the round operation.
    • roundToPrecision

      @BetaApi public final Expression roundToPrecision(int decimalPlace)
      Creates an expression that rounds off this numeric expression to decimalPlace decimal places if decimalPlace is positive, rounds off digits to the left of the decimal point if decimalPlace is negative. Rounds away from zero in halfway cases.
      Parameters:
      decimalPlace - The number of decimal places to round.
      Returns:
      A new Expression representing the round operation.
    • roundToPrecision

      @BetaApi public final Expression roundToPrecision(Expression decimalPlace)
      Creates an expression that rounds off this numeric expression to decimalPlace decimal places if decimalPlace is positive, rounds off digits to the left of the decimal point if decimalPlace is negative. Rounds away from zero in halfway cases.
      Parameters:
      decimalPlace - The number of decimal places to round.
      Returns:
      A new Expression representing the round operation.
    • trunc

      @BetaApi public final Expression trunc()
      Creates an expression that truncates this numeric expression to an integer.
      Returns:
      A new Expression representing the trunc operation.
    • truncToPrecision

      @BetaApi public final 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.
      Parameters:
      decimalPlace - The number of decimal places to truncate.
      Returns:
      A new Expression representing the trunc operation.
    • truncToPrecision

      @BetaApi public final Expression truncToPrecision(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.
      Parameters:
      decimalPlace - The number of decimal places to truncate.
      Returns:
      A new Expression representing the trunc operation.
    • ceil

      @BetaApi public final Expression ceil()
      Creates an expression that returns the smallest integer that isn't less than this numeric expression.
      Returns:
      A new Expression representing an integer result from the ceil operation.
    • floor

      @BetaApi public final Expression floor()
      Creates an expression that returns the largest integer that isn't less than this numeric expression.
      Returns:
      A new Expression representing an integer result from the floor operation.
    • pow

      @BetaApi public final Expression pow(Number exponent)
      Creates an expression that returns this numeric expression raised to the power of the exponent. Returns infinity on overflow and zero on underflow.
      Parameters:
      exponent - The numeric power to raise this numeric expression.
      Returns:
      A new Expression representing a numeric result from raising this numeric expression to the power of exponent.
    • pow

      @BetaApi public final Expression pow(Expression exponent)
      Creates an expression that returns this numeric expression raised to the power of the exponent. Returns infinity on overflow and zero on underflow.
      Parameters:
      exponent - The numeric power to raise this numeric expression.
      Returns:
      A new Expression representing a numeric result from raising this numeric expression to the power of exponent.
    • abs

      @BetaApi public final Expression abs()
      Creates an expression that returns the absolute value of this numeric expression.
      Returns:
      A new Expression representing the numeric result of the absolute value operation.
    • exp

      @BetaApi public final Expression exp()
      Creates an expression that returns Euler's number e raised to the power of this numeric expression.
      Returns:
      A new Expression representing the numeric result of the exponentiation.
    • ln

      @BetaApi public final Expression ln()
      Creates an expression that returns the natural logarithm (base e) of this numeric expression.
      Returns:
      A new Expression representing the numeric result of the natural logarithm.
    • log10

      @BetaApi public Expression log10()
      Creates an expression that returns the base 10 logarithm of this numeric expression.
      Returns:
      A new Expression representing the numeric result of the base 10 logarithm.
    • arraySum

      @BetaApi public Expression arraySum()
      Creates an expression that returns the sum of the elements of this array expression.
      Returns:
      A new Expression representing the sum of the elements of the array.
    • sqrt

      @BetaApi public final Expression sqrt()
      Creates an expression that returns the square root of this numeric expression.
      Returns:
      A new Expression representing the numeric result of the square root operation.
    • add

      @BetaApi public final Expression add(Object other)
      Creates an expression that adds this numeric expression to another numeric expression.
      Parameters:
      other - Numeric expression to add.
      Returns:
      A new Expression representing the addition operation.
    • subtract

      @BetaApi public final Expression subtract(Object other)
      Creates an expression that subtracts a numeric expressions from this numeric expression.
      Parameters:
      other - Constant to subtract.
      Returns:
      A new Expression representing the subtract operation.
    • multiply

      @BetaApi public final Expression multiply(Object other)
      Creates an expression that multiplies this numeric expression with another numeric expression.
      Parameters:
      other - Numeric expression to multiply.
      Returns:
      A new Expression representing the multiplication operation.
    • divide

      @BetaApi public final Expression divide(Object other)
      Creates an expression that divides this numeric expression by another numeric expression.
      Parameters:
      other - Numeric expression to divide this numeric expression by.
      Returns:
      A new Expression representing the division operation.
    • mod

      @BetaApi public final Expression mod(Object other)
      Creates an expression that calculates the modulo (remainder) of dividing this numeric expressions by another numeric expression.
      Parameters:
      other - The numeric expression to divide this expression by.
      Returns:
      A new Expression representing the modulo operation.
    • equal

      @BetaApi public final BooleanExpression equal(Object other)
      Creates an expression that checks if this expression is equal to a value.
      Parameters:
      other - The value to compare to.
      Returns:
      A new BooleanExpression representing the equality comparison.
    • notEqual

      @BetaApi public final BooleanExpression notEqual(Object other)
      Creates an expression that checks if this expression is not equal to a value.
      Parameters:
      other - The value to compare to.
      Returns:
      A new BooleanExpression representing the inequality comparison.
    • greaterThan

      @BetaApi public final BooleanExpression greaterThan(Object other)
      Creates an expression that checks if this expression is greater than a value.
      Parameters:
      other - The value to compare to.
      Returns:
      A new BooleanExpression representing the greater than comparison.
    • greaterThanOrEqual

      @BetaApi public final BooleanExpression greaterThanOrEqual(Object other)
      Creates an expression that checks if this expression is greater than or equal to a value.
      Parameters:
      other - The value to compare to.
      Returns:
      A new BooleanExpression representing the greater than or equal to comparison.
    • lessThan

      @BetaApi public final BooleanExpression lessThan(Object other)
      Creates an expression that checks if this expression is less than a value.
      Parameters:
      other - The value to compare to.
      Returns:
      A new BooleanExpression representing the less than comparison.
    • lessThanOrEqual

      @BetaApi public final BooleanExpression lessThanOrEqual(Object other)
      Creates an expression that checks if this expression is less than or equal to a value.
      Parameters:
      other - The value to compare to.
      Returns:
      A new BooleanExpression representing the less than or equal to comparison.
    • equalAny

      @BetaApi public final BooleanExpression equalAny(List<Object> other)
      Creates an expression that checks if this expression, when evaluated, is equal to any of the provided values.
      Parameters:
      other - The values to check against.
      Returns:
      A new BooleanExpression representing the 'IN' comparison.
    • notEqualAny

      @BetaApi public final BooleanExpression notEqualAny(List<Object> other)
      Creates an expression that checks if this expression, when evaluated, is not equal to all the provided values.
      Parameters:
      other - The values to check against.
      Returns:
      A new BooleanExpression representing the 'NOT IN' comparison.
    • charLength

      @BetaApi public final Expression charLength()
      Creates an expression that calculates the character length of this string expression in UTF8.
      Returns:
      A new Expression representing the charLength operation.
    • byteLength

      @BetaApi public final Expression byteLength()
      Creates an expression that calculates the length of a string in UTF-8 bytes, or just the length of a Blob.
      Returns:
      A new Expression representing the length of the string in bytes.
    • length

      @BetaApi public final Expression length()
      Creates an expression that calculates the length of the expression if it is a string, array, map, or Blob.
      Returns:
      A new Expression representing the length of the expression.
    • like

      @BetaApi public final BooleanExpression like(Object pattern)
      Creates an expression that performs a case-sensitive wildcard string comparison.
      Parameters:
      pattern - The pattern to search for. You can use "%" as a wildcard character.
      Returns:
      A new BooleanExpression representing the like operation.
    • regexContains

      @BetaApi public final BooleanExpression regexContains(Object pattern)
      Creates an expression that checks if this string expression contains a specified regular expression as a substring.
      Parameters:
      pattern - The regular expression to use for the search.
      Returns:
      A new BooleanExpression representing the contains regular expression comparison.
    • regexFind

      @BetaApi public final Expression regexFind(Object 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.

      Parameters:
      pattern - The regular expression to search for.
      Returns:
      A new Expression representing the regular expression find function.
    • regexFindAll

      @BetaApi public final Expression regexFindAll(Object 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.

      Parameters:
      pattern - The regular expression to search for.
      Returns:
      A new Expression that evaluates to a list of matched substrings.
    • regexMatch

      @BetaApi public final BooleanExpression regexMatch(Object pattern)
      Creates an expression that checks if this string expression matches a specified regular expression.
      Parameters:
      pattern - The regular expression to use for the match.
      Returns:
      A new BooleanExpression representing the regular expression match comparison.
    • stringContains

      @BetaApi public final BooleanExpression stringContains(Object substring)
      Creates an expression that checks if this string expression contains a specified substring.
      Parameters:
      substring - The expression representing the substring to search for.
      Returns:
      A new BooleanExpression representing the contains comparison.
    • startsWith

      @BetaApi public final BooleanExpression startsWith(Object prefix)
      Creates an expression that checks if this string expression starts with a given prefix.
      Parameters:
      prefix - The prefix string expression to check for.
      Returns:
      A new Expression representing the the 'starts with' comparison.
    • endsWith

      @BetaApi public final BooleanExpression endsWith(Object suffix)
      Creates an expression that checks if this string expression ends with a given suffix.
      Parameters:
      suffix - The suffix string expression to check for.
      Returns:
      A new Expression representing the 'ends with' comparison.
    • substring

      @BetaApi public final Expression substring(Object index, Object length)
      Creates an expression that returns a substring of the given string.
      Parameters:
      index - The starting index of the substring.
      length - The length of the substring.
      Returns:
      A new Expression representing the substring.
    • toLower

      @BetaApi public final Expression toLower()
      Creates an expression that converts this string expression to lowercase.
      Returns:
      A new Expression representing the lowercase string.
    • toUpper

      @BetaApi public final Expression toUpper()
      Creates an expression that converts this string expression to uppercase.
      Returns:
      A new Expression representing the lowercase string.
    • trim

      @BetaApi public final Expression trim()
      Creates an expression that removes leading and trailing whitespace from this string expression.
      Returns:
      A new Expression representing the trimmed string.
    • trimValue

      @BetaApi public Expression trimValue(String characters)
      Creates an expression that removes specified characters from the beginning and end of this string or blob expression.
      Parameters:
      characters - The characters to remove.
      Returns:
      A new Expression representing the trimmed string or blob.
    • trimValue

      @BetaApi public Expression trimValue(Expression characters)
      Creates an expression that removes specified characters from the beginning and end of this string or blob expression.
      Parameters:
      characters - The expression representing the characters to remove.
      Returns:
      A new Expression representing the trimmed string or blob.
    • split

      @BetaApi public Expression split(Expression delimiter)
      Creates an expression that splits this string or blob expression by a delimiter.
      Parameters:
      delimiter - The delimiter to split by.
      Returns:
      A new Expression representing the split string or blob as an array.
    • split

      @BetaApi public Expression split(String delimiter)
      Creates an expression that splits this string or blob expression by a delimiter.
      Parameters:
      delimiter - The delimiter to split by.
      Returns:
      A new Expression representing the split string or blob as an array.
    • stringConcat

      @BetaApi public final Expression stringConcat(String... others)
      Creates an expression that concatenates string expressions and string constants together.
      Parameters:
      others - The string expressions or string constants to concatenate.
      Returns:
      A new Expression representing the concatenated string.
    • stringConcat

      @BetaApi public final Expression stringConcat(Expression... others)
      Creates an expression that concatenates string expressions together.
      Parameters:
      others - The string expressions or string constants to concatenate.
      Returns:
      A new Expression representing the concatenated string.
    • mapGet

      @BetaApi public final Expression mapGet(Object key)
      Accesses a map (object) value using the provided key.
      Parameters:
      key - The key to access in the map.
      Returns:
      A new Expression representing the value associated with the given key in the map.
    • isAbsent

      @BetaApi public final BooleanExpression isAbsent()
      Creates an expression that returns true if yhe result of this expression is absent. Otherwise, returns false even if the value is null.
      Returns:
      A new BooleanExpression representing the isAbsent operation.
    • isNaN

      @BetaApi public final BooleanExpression isNaN()
      Creates an expression that checks if this expression evaluates to 'NaN' (Not a Number).
      Returns:
      A new BooleanExpression representing the isNan operation.
    • isNull

      @BetaApi public final BooleanExpression isNull()
      Creates an expression that checks if tbe result of this expression is null.
      Returns:
      A new BooleanExpression representing the isNull operation.
    • isNotNull

      @BetaApi public final BooleanExpression isNotNull()
      Creates an expression that checks if tbe result of this expression is not null.
      Returns:
      A new BooleanExpression representing the isNotNull operation.
    • sum

      @BetaApi public final AggregateFunction sum()
      Creates an aggregation that calculates the sum of this numeric expression across multiple stage inputs.
      Returns:
      A new AggregateFunction representing the sum aggregation.
    • average

      @BetaApi public final AggregateFunction average()
      Creates an aggregation that calculates the average (mean) of this numeric expression across multiple stage inputs.
      Returns:
      A new AggregateFunction representing the average aggregation.
    • minimum

      @BetaApi public final AggregateFunction minimum()
      Creates an aggregation that finds the minimum value of this expression across multiple stage inputs.
      Returns:
      A new AggregateFunction representing the minimum aggregation.
    • maximum

      @BetaApi public final AggregateFunction maximum()
      Creates an aggregation that finds the maximum value of this expression across multiple stage inputs.
      Returns:
      A new AggregateFunction representing the maximum aggregation.
    • count

      @BetaApi public final AggregateFunction count()
      Creates an aggregation that counts the number of stage inputs with valid evaluations of the this expression.
      Returns:
      A new AggregateFunction representing the count aggregation.
    • countDistinct

      @BetaApi public final AggregateFunction countDistinct()
      Creates an aggregation that counts the number of distinct values of this expression.
      Returns:
      A new AggregateFunction representing the count distinct aggregation.
    • first

      @BetaApi public final AggregateFunction first()
      Creates an aggregation that finds the first value of this expression across multiple stage inputs.
      Returns:
      A new AggregateFunction representing the first aggregation.
    • last

      @BetaApi public final AggregateFunction last()
      Creates an aggregation that finds the last value of this expression across multiple stage inputs.
      Returns:
      A new AggregateFunction representing the last aggregation.
    • arrayAgg

      @BetaApi public final 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:
      A new AggregateFunction representing the array_agg aggregation.
    • arrayAggDistinct

      @BetaApi public final 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:
      A new AggregateFunction representing the array_agg_distinct aggregation.
    • ascending

      @BetaApi public final Ordering ascending()
      Create an Ordering that sorts documents in ascending order based on value of this expression
      Returns:
      A new Ordering object with ascending sort by this expression.
    • descending

      @BetaApi public final Ordering descending()
      Create an Ordering that sorts documents in descending order based on value of this expression
      Returns:
      A new Ordering object with descending sort by this expression.
    • as

      @BetaApi public AliasedExpression as(String alias)
      Assigns an alias to this expression.

      Aliases are useful for renaming fields in the output of a stage or for giving meaningful names to calculated values.

      Parameters:
      alias - The alias to assign to this expression.
      Returns:
      A new AliasedExpression that wraps this expression and associates it with the provided alias.
    • mapMerge

      @BetaApi public final Expression mapMerge(Expression secondMap, Expression... otherMaps)
      Creates an expression that merges multiple maps into a single map. If multiple maps have the same key, the later value is used.
      Parameters:
      secondMap - Map expression that will be merged.
      otherMaps - Additional maps to merge.
      Returns:
      A new Expression representing the mapMerge operation.
    • mapRemove

      @BetaApi public final Expression mapRemove(Expression key)
      Creates an expression that removes a key from this map expression.
      Parameters:
      key - The name of the key to remove from this map expression.
      Returns:
      A new Expression that evaluates to a modified map.
    • mapRemove

      @BetaApi public final Expression mapRemove(String key)
      Creates an expression that removes a key from this map expression.
      Parameters:
      key - The name of the key to remove from this map expression.
      Returns:
      A new Expression that evaluates to a modified map.
    • reverse

      @BetaApi public final Expression reverse()
      Creates an expression that reverses this expression, which must be a string, blob, or array.
      Returns:
      A new Expression representing the reversed value.
    • arrayConcat

      @BetaApi public final Expression arrayConcat(Expression... otherArrays)
      Creates an expression that concatenates a field's array value with other arrays.
      Parameters:
      otherArrays - Optional additional array expressions or array literals to concatenate.
      Returns:
      A new Expression representing the arrayConcat operation.
    • arrayFirst

      @BetaApi public final Expression arrayFirst()
      Returns the first element of an array.
      Returns:
      A new Expression representing the first element of the array.
    • arrayFirstN

      @BetaApi public final Expression arrayFirstN(int n)
      Returns the first n elements of an array.
      Parameters:
      n - The number of elements to return.
      Returns:
      A new Expression representing the first n elements of the array.
    • arrayFirstN

      @BetaApi public final Expression arrayFirstN(Expression n)
      Returns the first n elements of an array.
      Parameters:
      n - The Expression evaluates to the number of elements to return.
      Returns:
      A new Expression representing the first n elements of the array.
    • arrayLast

      @BetaApi public final Expression arrayLast()
      Returns the last element of an array.
      Returns:
      A new Expression representing the last element of the array.
    • arrayLastN

      @BetaApi public final Expression arrayLastN(int n)
      Returns the last n elements of an array.
      Parameters:
      n - The number of elements to return.
      Returns:
      A new Expression representing the last n elements of the array.
    • arrayLastN

      @BetaApi public final Expression arrayLastN(Expression n)
      Returns the last n elements of an array.
      Parameters:
      n - The Expression evaluates to the number of elements to return.
      Returns:
      A new Expression representing the last n elements of the array.
    • arrayMinimum

      @BetaApi public final Expression arrayMinimum()
      Returns the minimum value of an array.
      Returns:
      A new Expression representing the minimum value of the array.
    • arrayMinimumN

      @BetaApi public final Expression arrayMinimumN(int n)
      Returns the n minimum values of an 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.

      Parameters:
      n - The number of elements to return.
      Returns:
      A new Expression representing the n minimum values of the array.
    • arrayMinimumN

      @BetaApi public final Expression arrayMinimumN(Expression n)
      Returns the n minimum values of an 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.

      Parameters:
      n - The Expression evaluates to the number of elements to return.
      Returns:
      A new Expression representing the n minimum values of the array.
    • arrayMaximum

      @BetaApi public final Expression arrayMaximum()
      Returns the maximum value of an array.
      Returns:
      A new Expression representing the maximum value of the array.
    • arrayMaximumN

      @BetaApi public final Expression arrayMaximumN(int n)
      Returns the n maximum values of an 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.

      Parameters:
      n - The number of elements to return.
      Returns:
      A new Expression representing the n maximum values of the array.
    • arrayMaximumN

      @BetaApi public final Expression arrayMaximumN(Expression n)
      Returns the n maximum values of an 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.

      Parameters:
      n - The Expression evaluates to the number of elements to return.
      Returns:
      A new Expression representing the n maximum values of the array.
    • arrayIndexOf

      @BetaApi public final Expression arrayIndexOf(Object value)
      Returns the index of the first occurrence of a value in an array.
      Parameters:
      value - The value to search for.
      Returns:
      A new Expression representing the index.
    • arrayIndexOf

      @BetaApi public final Expression arrayIndexOf(Expression value)
      Returns the index of the first occurrence of a value in an array.
      Parameters:
      value - The value to search for.
      Returns:
      A new Expression representing the index.
    • arrayLastIndexOf

      @BetaApi public final Expression arrayLastIndexOf(Object value)
      Returns the index of the last occurrence of a value in an array.
      Parameters:
      value - The value to search for.
      Returns:
      A new Expression representing the last index.
    • arrayLastIndexOf

      @BetaApi public final Expression arrayLastIndexOf(Expression value)
      Returns the index of the last occurrence of a value in an array.
      Parameters:
      value - The value to search for.
      Returns:
      A new Expression representing the last index.
    • arrayIndexOfAll

      @BetaApi public final Expression arrayIndexOfAll(Object value)
      Returns all indices of a value in an array.
      Parameters:
      value - The value to search for.
      Returns:
      A new Expression representing the indices.
    • arrayIndexOfAll

      @BetaApi public final Expression arrayIndexOfAll(Expression value)
      Returns all indices of a value in an array.
      Parameters:
      value - The value to search for.
      Returns:
      A new Expression representing the indices.
    • arrayReverse

      @BetaApi public final Expression arrayReverse()
      Reverses the order of elements in the array.
      Returns:
      A new Expression representing the arrayReverse operation.
    • arrayContains

      @BetaApi public final BooleanExpression arrayContains(Object element)
      Creates an expression that checks if array contains a specific element.
      Parameters:
      element - The element to search for in the array.
      Returns:
      A new BooleanExpression representing the arrayContains operation.
    • arrayContainsAll

      @BetaApi public final BooleanExpression arrayContainsAll(List<Object> values)
      Creates an expression that checks if array contains all the specified values.
      Parameters:
      values - The elements to check for in the array.
      Returns:
      A new BooleanExpression representing the arrayContainsAll operation.
    • arrayContainsAll

      @BetaApi public final BooleanExpression arrayContainsAll(Expression arrayExpression)
      Creates an expression that checks if array contains all elements of arrayExpression.
      Parameters:
      arrayExpression - The elements to check for in the array.
      Returns:
      A new BooleanExpression representing the arrayContainsAll operation.
    • arrayContainsAny

      @BetaApi public final BooleanExpression arrayContainsAny(List<Object> values)
      Creates an expression that checks if array contains any of the specified values.
      Parameters:
      values - The elements to check for in the array.
      Returns:
      A new BooleanExpression representing the arrayContainsAny operation.
    • arrayContainsAny

      @BetaApi public final BooleanExpression arrayContainsAny(Expression arrayExpression)
      Creates an expression that checks if array contains any elements of arrayExpression.
      Parameters:
      arrayExpression - The elements to check for in the array.
      Returns:
      A new BooleanExpression representing the arrayContainsAny operation.
    • arrayLength

      @BetaApi public final Expression arrayLength()
      Creates an expression that calculates the length of an array expression.
      Returns:
      A new Expression representing the length of the array.
    • arrayGet

      @BetaApi public final Expression arrayGet(Expression offset)
      Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end.
      Parameters:
      offset - An Expression evaluating to the index of the element to return.
      Returns:
      A new Expression representing the arrayGet operation.
    • arrayGet

      @BetaApi public final Expression arrayGet(int offset)
      Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end.
      Parameters:
      offset - An Expression evaluating to the index of the element to return.
      Returns:
      A new Expression representing the arrayOffset operation.
    • cosineDistance

      @BetaApi public final Expression cosineDistance(Expression vector)
      Calculates the Cosine distance between this and another vector expressions.
      Parameters:
      vector - The other vector (represented as an Expression) to compare against.
      Returns:
      A new Expression representing the cosine distance between the two vectors.
    • cosineDistance

      @BetaApi public final Expression cosineDistance(double[] vector)
      Calculates the Cosine distance between this vector expression and a vector literal.
      Parameters:
      vector - The other vector (as an array of doubles) to compare against.
      Returns:
      A new Expression representing the cosine distance between the two vectors.
    • dotProduct

      @BetaApi public final Expression dotProduct(Expression vector)
      Calculates the dot product distance between this and another vector expression.
      Parameters:
      vector - The other vector (represented as an Expression) to compare against.
      Returns:
      A new Expression representing the dot product distance between the two vectors.
    • dotProduct

      @BetaApi public final Expression dotProduct(double[] vector)
      Calculates the dot product distance between this vector expression and a vector literal.
      Parameters:
      vector - The other vector (as an array of doubles) to compare against.
      Returns:
      A new Expression representing the dot product distance between the two vectors.
    • euclideanDistance

      @BetaApi public final Expression euclideanDistance(Expression vector)
      Calculates the Euclidean distance between this and another vector expression.
      Parameters:
      vector - The other vector (represented as an Expression) to compare against.
      Returns:
      A new Expression representing the Euclidean distance between the two vectors.
    • euclideanDistance

      @BetaApi public final Expression euclideanDistance(double[] vector)
      Calculates the Euclidean distance between this vector expression and a vector literal.
      Parameters:
      vector - The other vector (as an array of doubles) to compare against.
      Returns:
      A new Expression representing the Euclidean distance between the two vectors.
    • vectorLength

      @BetaApi public final Expression vectorLength()
      Creates an expression that calculates the length (dimension) of a Firestore Vector.
      Returns:
      A new Expression representing the length (dimension) of the vector.
    • unixMicrosToTimestamp

      @BetaApi public final Expression unixMicrosToTimestamp()
      Creates an expression that interprets this expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
      Returns:
      A new Expression representing the timestamp.
    • timestampToUnixMicros

      @BetaApi public final Expression timestampToUnixMicros()
      Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
      Returns:
      A new Expression representing the number of microseconds since epoch.
    • unixMillisToTimestamp

      @BetaApi public final Expression unixMillisToTimestamp()
      Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
      Returns:
      A new Expression representing the timestamp.
    • timestampToUnixMillis

      @BetaApi public final Expression timestampToUnixMillis()
      Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).
      Returns:
      A new Expression representing the number of milliseconds since epoch.
    • unixSecondsToTimestamp

      @BetaApi public final Expression unixSecondsToTimestamp()
      Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.
      Returns:
      A new Expression representing the timestamp.
    • timestampToUnixSeconds

      @BetaApi public final Expression timestampToUnixSeconds()
      Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC).
      Returns:
      A new Expression representing the number of seconds since epoch.
    • timestampAdd

      @BetaApi public final Expression timestampAdd(Expression unit, Expression amount)
      Creates an expression that adds a specified amount of time to this timestamp expression.
      Parameters:
      unit - The expression representing the unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day".
      amount - The expression representing the amount of time to add.
      Returns:
      A new Expression representing the resulting timestamp.
    • timestampAdd

      @BetaApi public final Expression timestampAdd(String unit, long amount)
      Creates an expression that adds a specified amount of time to this timestamp expression.
      Parameters:
      unit - The unit of time to add. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day".
      amount - The amount of time to add.
      Returns:
      A new Expression representing the resulting timestamp.
    • timestampSubtract

      @BetaApi public final Expression timestampSubtract(Expression unit, Expression amount)
      Creates an expression that subtracts a specified amount of time to this timestamp expression.
      Parameters:
      unit - The expression representing the unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day".
      amount - The expression representing the amount of time to subtract.
      Returns:
      A new Expression representing the resulting timestamp.
    • timestampSubtract

      @BetaApi public final Expression timestampSubtract(String unit, long amount)
      Creates an expression that subtracts a specified amount of time to this timestamp expression.
      Parameters:
      unit - The unit of time to subtract. Valid units include "microsecond", "millisecond", "second", "minute", "hour" and "day".
      amount - The amount of time to subtract.
      Returns:
      A new Expression representing the resulting timestamp.
    • timestampTruncate

      @BetaApi public final Expression timestampTruncate(String granularity)
      Creates an expression that truncates this timestamp expression to a specified granularity.
      Parameters:
      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:
      A new Expression representing the truncated timestamp.
    • timestampTruncate

      @BetaApi public final Expression timestampTruncate(Expression granularity)
      Creates an expression that truncates this timestamp expression to a specified granularity.
      Parameters:
      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:
      A new Expression representing the truncated timestamp.
    • exists

      @BetaApi public final BooleanExpression exists()
      Creates an expression that checks if this expression evaluates to a name of the field that exists.
      Returns:
      A new Expression representing the exists check.
    • ifError

      @BetaApi public final Expression ifError(Expression catchExpr)
      Creates an expression that returns the catchExpr argument if there is an error, else return the result of this expression.
      Parameters:
      catchExpr - The catch expression that will be evaluated and returned if the this expression produces an error.
      Returns:
      A new Expression representing the ifError operation.
    • ifError

      @BetaApi public final Expression ifError(Object catchValue)
      Creates an expression that returns the catchValue argument if there is an error, else return the result of this expression.
      Parameters:
      catchValue - The value that will be returned if this expression produces an error.
      Returns:
      A new Expression representing the ifError operation.
    • isError

      @BetaApi public final BooleanExpression isError()
      Creates an expression that checks if this expression produces an error.
      Returns:
      A new BooleanExpression representing the `isError` check.
    • documentId

      @BetaApi public final Expression documentId()
      Creates an expression that returns the document ID from this path expression.
      Returns:
      A new Expression representing the documentId operation.
    • collectionId

      @BetaApi public final Expression collectionId()
      Creates an expression that returns the collection ID from this path expression.
      Returns:
      A new Expression representing the collectionId operation.
    • type

      @BetaApi public final Expression type()
      Creates an expression that returns a string indicating the type of the value this expression evaluates to.
      Returns:
      A new Expression representing the type operation.