lib/mongo/collection/view/aggregation.rb in mongo-2.9.2 vs lib/mongo/collection/view/aggregation.rb in mongo-2.10.0.rc0

- old
+ new

@@ -109,21 +109,21 @@ def valid_server?(server) server.standalone? || server.mongos? || server.primary? || secondary_ok? end - def out? - pipeline.any? { |op| op.key?('$out') || op.key?(:$out) } + def write? + pipeline.any? { |op| op.key?('$out') || op.key?(:$out) || op.key?('$merge') || op.key?(:$merge) } end def secondary_ok? - !out? + !write? end def send_initial_query(server, session) unless valid_server?(server) log_warn("Rerouting the Aggregation operation to the primary server - #{server.summary} is not suitable") - server = cluster.next_primary + server = cluster.next_primary(nil, session) end validate_collation!(server) initial_query_op(session).execute(server) end