AggregateQuery

public classAggregateQuery


A query that calculates aggregations over an underlying query.

Subclassing Note: Cloud Firestore classes are not meant to be subclassed except for use in test mocks. Subclassing is not supported in production code and new SDK releases may break code that does so.

Summary

Public fields

final @NonNullQuery

Public methods

boolean
equals(Object object)

Compares this object with the given object for equality.

@NonNullTask<AggregateQuerySnapshot>

Executes this query.

@NonNullQuery

Returns the query whose aggregations will be calculated by this object.

int

Calculates and returns the hash code for this object.

Public fields

query

public final @NonNullQuery query

Public methods

equals

public boolean equals(Object object)

Compares this object with the given object for equality.

This object is considered "equal" to the other object if and only if all of the following conditions are satisfied:

  1. object is a non-null instance ofAggregateQuery.
  2. object performs the same aggregations as thisAggregateQuery.
  3. The underlyingQuery ofobject compares equal to that of this object.
Parameters
Object object

The object to compare to this object for equality.

Returns
boolean

true if this object is "equal" to the given object, as defined above, or false otherwise.

get

public @NonNullTask<AggregateQuerySnapshotget(@NonNullAggregateSource source)

Executes this query.

Parameters
@NonNullAggregateSource source

The source from which to acquire the aggregate results.

Returns
@NonNullTask<AggregateQuerySnapshot>

ATask that will be resolved with the results of the query.

getQuery

public @NonNullQuery getQuery()

Returns the query whose aggregations will be calculated by this object.

hashCode

public int hashCode()

Calculates and returns the hash code for this object.

Returns
int

the hash code for this object.

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 2025-07-21 UTC.