FirebaseFirestore Framework Reference

Variable

public struct Variable : Expression, BridgeWrapper

A Variable is an Expression that retrieves the value of a variable bound via Pipeline.define.

Variables are typically defined in a define stage and can be referenced in subsequent stages.

Example:

firestore.pipeline().collection("products")
    .define([Field("price").multiply(0.9).as("discountedPrice")])
    .where(Variable("discountedPrice") < 100)
    .select([Field("name"), Variable("discountedPrice")])
  • Creates a new Variable expression from a variable name.

    Declaration

    Swift

    public init(_ name: String)

    Parameters

    name

    The name of the variable.