Class: Google::Cloud::Firestore::V1::StructuredAggregationQuery

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/firestore/v1/query.rb

Overview

Firestore query for running an aggregation over a StructuredQuery.

Defined Under Namespace

Classes: Aggregation

Instance Attribute Summary collapse

Instance Attribute Details

#aggregations::Array<::Google::Cloud::Firestore::V1::StructuredAggregationQuery::Aggregation>

Returns Optional. Series of aggregations to apply over the results of the structured_query.

Requires:

  • A minimum of one and maximum of five aggregations per query.

Returns:



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'proto_docs/google/firestore/v1/query.rb', line 375

class StructuredAggregationQuery
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Defines a aggregation that produces a single result.
  # @!attribute [rw] count
  #   @return [::Google::Cloud::Firestore::V1::StructuredAggregationQuery::Aggregation::Count]
  #     Count aggregator.
  # @!attribute [rw] alias
  #   @return [::String]
  #     Optional. Optional name of the field to store the result of the
  #     aggregation into.
  #
  #     If not provided, Firestore will pick a default name following the format
  #     `field_<incremental_id++>`. For example:
  #
  #     ```
  #     AGGREGATE
  #       COUNT_UP_TO(1) AS count_up_to_1,
  #       COUNT_UP_TO(2),
  #       COUNT_UP_TO(3) AS count_up_to_3,
  #       COUNT_UP_TO(4)
  #     OVER (
  #       ...
  #     );
  #     ```
  #
  #     becomes:
  #
  #     ```
  #     AGGREGATE
  #       COUNT_UP_TO(1) AS count_up_to_1,
  #       COUNT_UP_TO(2) AS field_1,
  #       COUNT_UP_TO(3) AS count_up_to_3,
  #       COUNT_UP_TO(4) AS field_2
  #     OVER (
  #       ...
  #     );
  #     ```
  #
  #     Requires:
  #
  #     * Must be unique across all aggregation aliases.
  #     * Conform to {::Google::Cloud::Firestore::V1::Document#fields document field name}
  #     limitations.
  class Aggregation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Count of documents that match the query.
    #
    # The `COUNT(*)` aggregation function operates on the entire document
    # so it does not require a field reference.
    # @!attribute [rw] up_to
    #   @return [::Google::Protobuf::Int64Value]
    #     Optional. Optional constraint on the maximum number of documents to
    #     count.
    #
    #     This provides a way to set an upper bound on the number of documents
    #     to scan, limiting latency and cost.
    #
    #     Unspecified is interpreted as no bound.
    #
    #     High-Level Example:
    #
    #     ```
    #     AGGREGATE COUNT_UP_TO(1000) OVER ( SELECT * FROM k );
    #     ```
    #
    #     Requires:
    #
    #     * Must be greater than zero when present.
    class Count
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#structured_query::Google::Cloud::Firestore::V1::StructuredQuery

Returns Nested structured query.

Returns:



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'proto_docs/google/firestore/v1/query.rb', line 375

class StructuredAggregationQuery
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Defines a aggregation that produces a single result.
  # @!attribute [rw] count
  #   @return [::Google::Cloud::Firestore::V1::StructuredAggregationQuery::Aggregation::Count]
  #     Count aggregator.
  # @!attribute [rw] alias
  #   @return [::String]
  #     Optional. Optional name of the field to store the result of the
  #     aggregation into.
  #
  #     If not provided, Firestore will pick a default name following the format
  #     `field_<incremental_id++>`. For example:
  #
  #     ```
  #     AGGREGATE
  #       COUNT_UP_TO(1) AS count_up_to_1,
  #       COUNT_UP_TO(2),
  #       COUNT_UP_TO(3) AS count_up_to_3,
  #       COUNT_UP_TO(4)
  #     OVER (
  #       ...
  #     );
  #     ```
  #
  #     becomes:
  #
  #     ```
  #     AGGREGATE
  #       COUNT_UP_TO(1) AS count_up_to_1,
  #       COUNT_UP_TO(2) AS field_1,
  #       COUNT_UP_TO(3) AS count_up_to_3,
  #       COUNT_UP_TO(4) AS field_2
  #     OVER (
  #       ...
  #     );
  #     ```
  #
  #     Requires:
  #
  #     * Must be unique across all aggregation aliases.
  #     * Conform to {::Google::Cloud::Firestore::V1::Document#fields document field name}
  #     limitations.
  class Aggregation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Count of documents that match the query.
    #
    # The `COUNT(*)` aggregation function operates on the entire document
    # so it does not require a field reference.
    # @!attribute [rw] up_to
    #   @return [::Google::Protobuf::Int64Value]
    #     Optional. Optional constraint on the maximum number of documents to
    #     count.
    #
    #     This provides a way to set an upper bound on the number of documents
    #     to scan, limiting latency and cost.
    #
    #     Unspecified is interpreted as no bound.
    #
    #     High-Level Example:
    #
    #     ```
    #     AGGREGATE COUNT_UP_TO(1000) OVER ( SELECT * FROM k );
    #     ```
    #
    #     Requires:
    #
    #     * Must be greater than zero when present.
    class Count
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end