class RocketJob::LookupCollection
Public Instance Methods
lookup(id)
click to toggle source
Looks up the value at the specified id. Returns [nil] if no record was found with the supplied id.
# File lib/rocket_job/lookup_collection.rb, line 21 def lookup(id) find(id: id).first end
upload(batch_size: 10_000, &block)
click to toggle source
Rapidly upload individual records in batches.
Operates directly on a Mongo
Collection to avoid the overhead of creating Mongoid
objects for each and every row.
Example:
lookup_collection(:my_lookup).upload do |io| io << {id: 123, data: "first record"} io << {id: 124, data: "second record"} end input_category(:my_lookup).find(id: 123).first
# File lib/rocket_job/lookup_collection.rb, line 15 def upload(batch_size: 10_000, &block) BatchUploader.upload(batch_size: batch_size, &block) end