File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -386,8 +386,12 @@ def query_opts
386386 def add_option ( opt )
387387 check_modifiable
388388
389- if exhaust? ( opt ) && ( @limit != 0 )
390- raise MongoArgumentError , "Exhaust option is incompatible with limit."
389+ if exhaust? ( opt )
390+ if @limit != 0
391+ raise MongoArgumentError , "Exhaust is incompatible with limit."
392+ elsif @connection . mongos?
393+ raise MongoArgumentError , "Exhaust is incompatible with mongos."
394+ end
391395 end
392396
393397 @options |= opt
Original file line number Diff line number Diff line change @@ -110,6 +110,15 @@ def test_limit_after_exhaust_error
110110 end
111111 end
112112
113+ def test_exhaust_with_mongos
114+ @@connection . expects ( :mongos? ) . returns ( :true )
115+ c = Cursor . new ( @@coll )
116+
117+ assert_raise MongoArgumentError do
118+ c . add_option ( OP_QUERY_EXHAUST )
119+ end
120+ end
121+
113122 def test_inspect
114123 selector = { :a => 1 }
115124 cursor = @@coll . find ( selector )
You can’t perform that action at this time.
0 commit comments