Generic functions

Preview:Firestore in Native mode (with Pipeline operations) for Enterpriseedition is subject to the "Pre-GA Offerings Terms" in the GeneralService Terms section of theService SpecificTerms. You can process personaldata for this feature as outlined in theCloud Data Processing Addendum, subjectto the obligations and restrictions described in the agreement under which youaccess Google Cloud. Pre-GA features are available "as is" and might havelimited support. For more information, see thelaunch stagedescriptions.

Generic Functions

NameDescription
CONCATConcatenates two or more values of same type.
LENGTHCalculates the length of aString,Bytes,Array,Vector, orMap.
REVERSEReverses aString,Bytes, orArray.

Client Examples

Node.js
concat(constant("Author ID: "),field("authorId"));

Web

concat(constant("Author ID: "),field("authorId"));
Swift
letdisplayString=Constant("Author ID: ").concat([Field("authorId")])

Kotlin

valdisplayString=constant("Author ID: ").concat(field("authorId"))

Java

ExpressiondisplayString=constant("Author ID: ").concat(field("authorId"));
Python
Constant.of("Author ID: ").concat(Field.of("authorId"))

CONCAT

Syntax:

concat[T <: STRING | BYTES | ARRAY](values:T ...) -> T

Description:

Concatenates two or more values of same type.

Examples:

valuesconcat(values)
"abc", "def""abcdef"
[1, 2], [3, 4][1, 2, 3, 4]
b"abc", b"def"b"abcdef"
"abc", [1,2,3], "ghi"error
[1,2,3]error
"abc", nullnull

LENGTH

Syntax:

length[T <: STRING | BYTES | ARRAY | VECTOR | MAP](value: T) -> INT64

Description:

Calculates the length of aString,Bytes,Array,Vector, orMap value.

Examples:

valuelength(value)
"hello"5
[1, 2, 3, 4]4
b"abcde"5
nullnull
1error

REVERSE

Syntax:

reverse[T <: STRING | BYTES | ARRAY](value: T) -> T

Description:

Reverses aString,Bytes, orArray value.

Examples:

valuereverse(value)
"hello""olleh"
[1, 2, 3][3, 2, 1]
b"abc"b"cba"
23error
nullnull

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-18 UTC.