Class AggregateQuery

java.lang.Object
com.google.cloud.firestore.AggregateQuery

@InternalExtensionOnly public class AggregateQuery extends Object
A query that calculates aggregations over an underlying query.
  • Method Details

    • getQuery

      @Nonnull public Query getQuery()
      Returns the query whose aggregations will be calculated by this object.
    • get

      @Nonnull public com.google.api.core.ApiFuture<AggregateQuerySnapshot> get()
      Executes this query.
      Returns:
      An ApiFuture that will be resolved with the results of the query.
    • explain

      @Nonnull public com.google.api.core.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).
      Returns:
      An ApiFuture that will be resolved with the planner information, statistics from the query execution (if any), and the query results (if any).
    • toProto

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

      @Nonnull 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:
      firestore - a Firestore instance to apply the query to.
      proto - the serialized RunAggregationQueryRequest.
      Returns:
      a AggregateQuery instance that can be used to execute the RunAggregationQueryRequest.
    • hashCode

      public int hashCode()
      Calculates and returns the hash code for this object.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code for this object.
    • 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 of AggregateQuery.
      2. object performs the same aggregations as this AggregateQuery.
      3. The underlying Query of object compares equal to that of this object.
      Overrides:
      equals in class Object
      Parameters:
      object - The object to compare to this object for equality.
      Returns:
      true if this object is "equal" to the given object, as defined above, or false otherwise.