FirebaseFirestore Framework Reference

AggregateFunction

public class AggregateFunction : AggregateBridgeWrapper, @unchecked Sendable

Represents an aggregate function in a pipeline.

An AggregateFunction is a function that computes a single value from a set of input values.

AggregateFunctions are typically used in the aggregate stage of a pipeline.

  • Creates a new AggregateFunction.

    Declaration

    Swift

    public init(functionName: String, args: [Expression])

    Parameters

    functionName

    The name of the aggregate function.

    args

    The arguments to the aggregate function.

  • Creates an AliasedAggregate from this aggregate function.

    Declaration

    Swift

    public func `as`(_ name: String) -> AliasedAggregate

    Parameters

    name

    The alias for the aggregate function.

    Return Value

    An AliasedAggregate with the given alias.