Skip to content

Instantly share code, notes, and snippets.

@simsicon simsicon/query.rb
Created Mar 13, 2014

Embed
What would you like to do?
Mongoid doesn't support find_in_batches, this is a work around for it.
per_batch = 10
0.step(User.count, per_batch) do |offset|
puts User.limit(per_batch).skip(offset).map(&:username).inspect
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.