Method: Mongo::Cursor#batch_size
- Defined in:
- lib/mongo/cursor.rb
#batch_size(size = 0) ⇒ Cursor
Set the batch size for server responses.
Note that the batch size will take effect only on queries where the number to be returned is greater than 100.
204 205 206 207 208 209 210 211 212 213 |
# File 'lib/mongo/cursor.rb', line 204 def batch_size(size=0) check_modifiable if size < 0 || size == 1 raise ArgumentError, "Invalid value for batch_size #{size}; must be 0 or > 1." else @batch_size = size > @limit ? @limit : size end self end |