Represents an aggregation that can be performed by Firestore.
Package
@google-cloud/firestoreRemarks
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the AggregateField
class.
Properties
aggregateType
readonly aggregateType: AggregateType;
type
readonly type = "AggregateField";
A type string to uniquely identify instances of this class.
Methods
average(field)
static average(field: string | FieldPath): AggregateField<number | null>;
Create an AggregateField 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.
Parameter | |
---|---|
Name | Description |
field |
string | FieldPath
Specifies the field to average across the result set. |
Returns | |
---|---|
Type | Description |
AggregateField<number | null> |
count()
static count(): AggregateField<number>;
Create an AggregateField object that can be used to compute the count of documents in the result set of a query.
Returns | |
---|---|
Type | Description |
AggregateField<number> |
isEqual(other)
isEqual(other: AggregateField<T>): boolean;
Compares this object with the given object for equality.
This object is considered "equal" to the other object if and only if other
performs the same kind of aggregation on the same field (if any).
Parameter | |
---|---|
Name | Description |
other |
AggregateField<T>
The object to compare to this object for equality. |
Returns | |
---|---|
Type | Description |
boolean |
sum(field)
static sum(field: string | FieldPath): AggregateField<number>;
Create an AggregateField 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.
Parameter | |
---|---|
Name | Description |
field |
string | FieldPath
Specifies the field to sum across the result set. |
Returns | |
---|---|
Type | Description |
AggregateField<number> |