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
386386 def add_option ( opt )
387387 check_modifiable
388388
389- if ( opt == OP_QUERY_EXHAUST ) && ( @limit != 0 )
389+ if exhaust? ( opt ) && ( @limit != 0 )
390390 raise MongoArgumentError , "Exhaust option is incompatible with limit."
391391 end
392392
@@ -633,8 +633,8 @@ def close_cursor_if_query_complete
633633 # Check whether the exhaust option is set
634634 #
635635 # @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?
638638 end
639639
640640 def check_modifiable
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ def test_exhaust_after_limit_error
9696 assert_raise MongoArgumentError do
9797 c . add_option ( OP_QUERY_EXHAUST )
9898 end
99+
100+ assert_raise MongoArgumentError do
101+ c . add_option ( OP_QUERY_EXHAUST + OP_QUERY_SLAVE_OK )
102+ end
99103 end
100104
101105 def test_limit_after_exhaust_error
You can’t perform that action at this time.
0 commit comments