class MongoHTTPSync::MongoidImporter
Protected Instance Methods
find_last_updated_doc()
click to toggle source
# File lib/mongo_http_sync/mongoid_importer.rb, line 10 def find_last_updated_doc @output.reorder(updated_at: :desc).first end
upsert(json)
click to toggle source
# File lib/mongo_http_sync/mongoid_importer.rb, line 14 def upsert(json) doc = @output.where(_id: json[:_id]).first if doc.nil? @output.create! json else doc.update_attributes! json end end