lib/mongo/collection/view/readable.rb
# Execute an aggregation on the collection view.
#
# @example Aggregate documents.
#   view.aggregate([
#     { "$group" => { "_id" => "$city", "tpop" => { "$sum" => "$pop" }}}
#   ])
#
# @param [ Array<Hash> ] pipeline The aggregation pipeline.
# @param [ Hash ] options The aggregation options.
#
# @return [ Aggregation ] The aggregation object.
#
# @since 2.0.0
Execute an aggregation on the collection view.
Execute an aggregation on the collection view .
def aggregate(pipeline, options = {})
          aggregation = Aggregation.new(self, pipeline, options)
           Opt to clear the entire cache rather than one namespace because
           the $out and $merge stages do not have to write to the same namespace
           on which the aggregation is performed.
          QueryCache.clear if aggregation.write?
          aggregation
        end
def aggregate ( pipeline , options = { } ) aggregation = Aggregation . new ( self , pipeline , options ) QueryCache . clear if aggregation . write? aggregation end
Execute an aggregation on the collection view.
Execute an aggregation on the collection view .
# Because the $merge and $out pipeline stages write documents to the # collection, it is necessary to clear the cache when they are performed. # # Opt to clear the entire cache rather than one namespace because # the $out and $merge stages do not have to write to the same namespace # on which the aggregation is performed.
The aggregation object.
The aggregation object .
 Aggregation 
pipeline
<not_specific>
options
<not_specific>
<not_specific>
options The aggregation options.
options The aggregation options .
example
None
since
None