lib/mongo/collection/view/aggregation.rb in mongo-2.1.0.rc0 vs lib/mongo/collection/view/aggregation.rb in mongo-2.1.0
- old
+ new
@@ -24,10 +24,11 @@
include Enumerable
include Immutable
include Iterable
include Explainable
include Loggable
+ include Retryable
# @return [ View ] view The collection view.
attr_reader :view
# @return [ Array<Hash> ] pipeline The aggregation pipeline.
attr_reader :pipeline
@@ -40,15 +41,20 @@
# Options mapping for an aggregation.
#
# @since 2.1.0
OPTIONS_MAP = {
- :allow_disk_use => :allowDiskUse,
- :max_time_ms => :maxTimeMS,
- :explain => :explain
- }
+ :allow_disk_use => :allowDiskUse,
+ :max_time_ms => :maxTimeMS,
+ :explain => :explain
+ }.freeze
+ # The reroute message.
+ #
+ # @since 2.1.0
+ REROUTE = 'Rerouting the Aggregation operation to the primary server.'.freeze
+
# Set to true if disk usage is allowed during the aggregation.
#
# @example Set disk usage flag.
# aggregation.allow_disk_use(true)
#
@@ -141,10 +147,10 @@
pipeline.none? { |op| op.key?('$out') || op.key?(:$out) }
end
def send_initial_query(server)
unless valid_server?(server)
- log_warn('Rerouting the Aggregation operation to the primary server.')
+ log_warn(REROUTE)
server = cluster.next_primary
end
initial_query_op.execute(server.context)
end
end