Reference documentation and code samples for the Cloud Firestore Client class AggregateQuery.
A Cloud Firestore Aggregate Query.
Example:
use Google\Cloud\Firestore\FirestoreClient;
$firestore = new FirestoreClient();
$collection = $firestore->collection('users');
$query = $collection->where('age', '>', 18)->count();
Namespace
Google \ Cloud \ FirestoreMethods
__construct
Create an aggregation query.
| Parameters | |
|---|---|
| Name | Description |
firestoreClient |
V1\Client\FirestoreClient
A FirestoreClient instance. |
parent |
string
The parent of the query. |
query |
array
Represents the underlying structured query. |
aggregate |
Aggregate
Aggregation over the provided query. |
addAggregation
Adds provided aggregation to AggregateQuery.
| Parameter | |
|---|---|
| Name | Description |
aggregate |
Aggregate
Aggregate properties to be applied over query. |
| Returns | |
|---|---|
| Type | Description |
AggregateQuery |
|
getSnapshot
Executes the AggregateQuery.
| Parameters | |
|---|---|
| Name | Description |
options |
array
Configuration options is an array. |
↳ readTime |
Timestamp
Reads entities as they were at the given timestamp. |
↳ explainOptions |
ExplainOptions
An instance of the ExplainOptions class. ExplainOptions} </xref
|
| Returns | |
|---|---|
| Type | Description |
AggregateQuerySnapshot |
|