Class AggregateQuery (3.21.0)

public class AggregateQuery

A query that calculates aggregations over an underlying query.

Inheritance

Object > AggregateQuery

Static Methods

fromProto(Firestore firestore, RunAggregationQueryRequest proto)

public static AggregateQuery fromProto(Firestore firestore, RunAggregationQueryRequest proto)

Returns an AggregateQuery instance that can be used to execute the provided RunAggregationQueryRequest.

Only RunAggregationQueryRequests that pertain to the same project as the Firestore instance can be deserialized.

Parameters
Name Description
firestore Firestore

a Firestore instance to apply the query to.

proto RunAggregationQueryRequest

the serialized RunAggregationQueryRequest.

Returns
Type Description
AggregateQuery

a AggregateQuery instance that can be used to execute the RunAggregationQueryRequest.

Methods

equals(Object object)

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 of AggregateQuery.
  2. object performs the same aggregations as this AggregateQuery.
  3. The underlying Query of object compares equal to that of this object.
Parameter
Name Description
object Object

The object to compare to this object for equality.

Returns
Type Description
boolean

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

Overrides

explain(ExplainOptions options)

public ApiFuture<ExplainResults<AggregateQuerySnapshot>> explain(ExplainOptions options)

Plans and optionally executes this query. Returns an ApiFuture that will be resolved with the planner information, statistics from the query execution (if any), and the query results (if any).

Parameter
Name Description
options ExplainOptions
Returns
Type Description
ApiFuture<ExplainResults<AggregateQuerySnapshot>>

An ApiFuture that will be resolved with the planner information, statistics from the query execution (if any), and the query results (if any).

get()

public ApiFuture<AggregateQuerySnapshot> get()

Executes this query.

Returns
Type Description
ApiFuture<AggregateQuerySnapshot>

An ApiFuture that will be resolved with the results of the query.

getQuery()

public Query getQuery()

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

Returns
Type Description
Query

hashCode()

public int hashCode()

Calculates and returns the hash code for this object.

Returns
Type Description
int

the hash code for this object.

Overrides

toProto()

public RunAggregationQueryRequest toProto()

Returns the RunAggregationQueryRequest that this AggregateQuery instance represents. The request contain the serialized form of all aggregations and Query constraints.

Returns
Type Description
RunAggregationQueryRequest

the serialized RunAggregationQueryRequest