lib/mongo/operation/commands/aggregate.rb in mongo-2.2.7 vs lib/mongo/operation/commands/aggregate.rb in mongo-2.3.0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (C) 2014-2015 MongoDB, Inc. +# Copyright (C) 2014-2016 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # @@ -41,20 +41,20 @@ # @since 2.0.0 class Aggregate < Command private - def filter_selector(context) - return selector if context.features.write_command_enabled? + def filter_selector(server) + return selector if server.features.write_command_enabled? selector.reject{ |option, value| option.to_s == 'cursor' } end - def update_selector(context) - if context.mongos? && read_pref = read.to_mongos - sel = selector[:$query] ? filter_selector(context) : { :$query => filter_selector(context) } + def update_selector(server) + if server.mongos? && read_pref = read.to_mongos + sel = selector[:$query] ? filter_selector(server) : { :$query => filter_selector(server) } sel.merge(:$readPreference => read_pref) else - filter_selector(context) + filter_selector(server) end end end end end