Reference documentation and code samples for the Cloud Firestore API class Google::Cloud::Firestore::AggregateQuerySnapshot.
AggregateQuerySnapshot
An aggregate query snapshot object is an immutable representation for an aggregate query result.
Inherits
- Object
Example
require "google/cloud/firestore" firestore = Google::Cloud::Firestore.new query = firestore.col "cities" # Create an aggregate query aggregate_query = query.aggregate_query .add_count aggregate_query.get do |aggregate_snapshot| puts aggregate_snapshot.get('count') end
Methods
#get
def get(aggregate_alias) -> Integer
Retrieves the aggregate data.
Parameter
- aggregate_alias (String) — The alias used to access the aggregate value. For count, the default value is "count".
Returns
Example
- (Integer) — The aggregate value.
require "google/cloud/firestore" firestore = Google::Cloud::Firestore.new query = firestore.col "cities" # Create an aggregate query aggregate_query = query.aggregate_query .add_count aggregate_query.get do |aggregate_snapshot| puts aggregate_snapshot.get('count') end