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
386
386
def add_option ( opt )
387
387
check_modifiable
388
388
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
391
395
end
392
396
393
397
@options |= opt
Original file line number Diff line number Diff line change @@ -110,6 +110,15 @@ def test_limit_after_exhaust_error
110
110
end
111
111
end
112
112
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
+
113
122
def test_inspect
114
123
selector = { :a => 1 }
115
124
cursor = @@coll . find ( selector )
You can’t perform that action at this time.
0 commit comments