Sha256: 2961daa1ed3a87b68cedb3748c48e4264e8451c6aa909bc17ac4c5b5f63799f6
Contents?: true
Size: 358 Bytes
Versions: 27
Compression:
Stored size: 358 Bytes
Contents
module MongoModel class Scope module Batches def in_batches(batch_size=1000) offset = 0 begin documents = offset(offset).limit(batch_size).all yield documents if block_given? && !documents.empty? offset += batch_size end until documents.size < batch_size end end end end
Version data entries
27 entries across 27 versions & 1 rubygems