File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -386,7 +386,7 @@ def query_opts
386
386
def add_option ( opt )
387
387
check_modifiable
388
388
389
- if ( opt == OP_QUERY_EXHAUST ) && ( @limit != 0 )
389
+ if exhaust? ( opt ) && ( @limit != 0 )
390
390
raise MongoArgumentError , "Exhaust option is incompatible with limit."
391
391
end
392
392
@@ -633,8 +633,8 @@ def close_cursor_if_query_complete
633
633
# Check whether the exhaust option is set
634
634
#
635
635
# @return [true, false] The state of the exhaust flag.
636
- def exhaust?
637
- !( @options & OP_QUERY_EXHAUST ) . zero?
636
+ def exhaust? ( opts = options )
637
+ !( opts & OP_QUERY_EXHAUST ) . zero?
638
638
end
639
639
640
640
def check_modifiable
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ def test_exhaust_after_limit_error
96
96
assert_raise MongoArgumentError do
97
97
c . add_option ( OP_QUERY_EXHAUST )
98
98
end
99
+
100
+ assert_raise MongoArgumentError do
101
+ c . add_option ( OP_QUERY_EXHAUST + OP_QUERY_SLAVE_OK )
102
+ end
99
103
end
100
104
101
105
def test_limit_after_exhaust_error
You can’t perform that action at this time.
0 commit comments