mongoid - How can I ignore the fatal error from mongodb, prevent it break my long-time parsing task -


i'm importing billions of records , insert mongodb.

after running 10 hours, got error 'client error: remaining data small bson object'.

and error broke task,

i tried use try exception skip buggy data, , keep going.

but didn't work too.(the exception still breaks parsing task)

so wonder how let mongodb don't break script, errors occurs, ignore , keep going.

  def bulk_insert_to_collection(collection_name)     model = collection_name.capitalize.constantize.new     begin       model.collection.insert(@data_in_chunk)     rescue exception => e       # ignore     end   end 

put batch insert inside of loop when 1 batch fails can move on next one. should insert 1000 @ time anyway because that mongo supports. allows had handle failures want without losing insert performance.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -