Package com.google.cloud.firestore
Class AggregateField
java.lang.Object
com.google.cloud.firestore.AggregateField
- Direct Known Subclasses:
AggregateField.AverageAggregateField,AggregateField.CountAggregateField,AggregateField.SumAggregateField
Represents an aggregation that can be performed by Firestore.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents an "average" aggregation that can be performed by Firestore.static classRepresents a "count" aggregation that can be performed by Firestore.static classRepresents a "sum" aggregation that can be performed by Firestore. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate anAggregateField.AverageAggregateFieldobject that can be used to compute the average of a specified field over a range of documents in the result set of a query.Create anAggregateField.AverageAggregateFieldobject that can be used to compute the average of a specified field over a range of documents in the result set of a query.count()Create aAggregateField.CountAggregateFieldobject that can be used to compute the count of documents in the result set of a query.booleanReturns true if the given object is equal to this object.inthashCode()Calculates and returns the hash code for this object.Create aAggregateField.SumAggregateFieldobject that can be used to compute the sum of a specified field over a range of documents in the result set of a query.Create aAggregateField.SumAggregateFieldobject that can be used to compute the sum of a specified field over a range of documents in the result set of a query.
-
Constructor Details
-
AggregateField
public AggregateField()
-
-
Method Details
-
count
Create aAggregateField.CountAggregateFieldobject that can be used to compute the count of documents in the result set of a query.The result of a count operation will always be a 64-bit integer value.
- Returns:
- The `CountAggregateField` object that can be used to compute the count of documents in the result set of a query.
-
sum
Create aAggregateField.SumAggregateFieldobject that can be used to compute the sum of a specified field over a range of documents in the result set of a query.The result of a sum operation will always be a 64-bit integer value, a double, or NaN.
- Summing over zero documents or fields will result in 0L.
- Summing over NaN will result in a double value representing NaN.
- A sum that overflows the maximum representable 64-bit integer value will result in a double return value. This may result in lost precision of the result.
- A sum that overflows the maximum representable double value will result in a double return value representing infinity.
- Parameters:
field- Specifies the field to sum across the result set.- Returns:
- The `SumAggregateField` object that can be used to compute the sum of a specified field over a range of documents in the result set of a query.
-
sum
Create aAggregateField.SumAggregateFieldobject that can be used to compute the sum of a specified field over a range of documents in the result set of a query.The result of a sum operation will always be a 64-bit integer value, a double, or NaN.
- Summing over zero documents or fields will result in 0L.
- Summing over NaN will result in a double value representing NaN.
- A sum that overflows the maximum representable 64-bit integer value will result in a double return value. This may result in lost precision of the result.
- A sum that overflows the maximum representable double value will result in a double return value representing infinity.
- Parameters:
fieldPath- Specifies the field to sum across the result set.- Returns:
- The `SumAggregateField` object that can be used to compute the sum of a specified field over a range of documents in the result set of a query.
-
average
Create anAggregateField.AverageAggregateFieldobject that can be used to compute the average of a specified field over a range of documents in the result set of a query.The result of an average operation will always be a double or NaN.
- Averaging over zero documents or fields will result in a double value representing NaN.
- Averaging over NaN will result in a double value representing NaN.
- Parameters:
field- Specifies the field to average across the result set.- Returns:
- The `AverageAggregateField` object that can be used to compute the average of a specified field over a range of documents in the result set of a query.
-
average
Create anAggregateField.AverageAggregateFieldobject that can be used to compute the average of a specified field over a range of documents in the result set of a query.The result of an average operation will always be a double or NaN.
- Averaging over zero documents or fields will result in a double value representing NaN.
- Averaging over NaN will result in a double value representing NaN.
- Parameters:
fieldPath- Specifies the field to average across the result set.- Returns:
- The `AverageAggregateField` object that can be used to compute the average of a specified field over a range of documents in the result set of a query.
-
equals
Returns true if the given object is equal to this object. Two `AggregateField` objects are considered equal if they have the same operator and operate on the same field. -
hashCode
public int hashCode()Calculates and returns the hash code for this object.
-