-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.0.6
-
Component/s: Sharded Cluster
-
None
We have code that looks like:
client = Mongo::Client.new(..., connect: :sharded, database: 'admin') inprog = client['$cmd.sys.inprog'].find('$all' => true).limit(-1).skip(0).first
This code works fine to find current operations for replicaset setups, but it does not work for sharded setups.
The error we encounter is:
Mongo::Error::OperationFailure: DBClientBase::findN: transport error: <ip>:27017 ns: admin.$cmd.sys.inprog query: { $query: { $all: true } } (10276)
from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/operation/result.rb:214:in `validate!'
from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/operation/read/query.rb:62:in `block in execute_message'
from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/server/connection_pool.rb:99:in `with_connection'
from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/server/context.rb:63:in `with_connection'
from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/operation/read/query.rb:61:in `execute_message'
from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/operation/read/query.rb:55:in `execute'
from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/collection/view.rb:164:in `send_initial_query'
from /app/vendor/bundle/ruby/2.1.0/gems/mongo-2.0.6/lib/mongo/collection/view/iterable.rb:39:in `each'
It's worth noting we're also using SSL.
Looking at the code from the mongo shell, it seems like the only thing they do differently is disabling the read preference for the command. I have tried a few different read settings, none have worked in my testing.
Would it be possible to get a special method to get current operations for a database? The way the code works, I don't think I can easily "remove" the read preference for a query.