0

I am trying to insert a lot of data (millions of documents) into mongodb using pymongo from a variety of files which I will obtain at different times.

Each file will have the same primary id, but can have the same or different attributes, defined based on different columns in the file.

If the record exists, I would like to add any new attributes and append any existing ones. If the record doesn't exist, I would like to create it.

What would the best way to do this using pymongo?

Blakes Seven
  • 49,422
  • 14
  • 129
  • 135
Iain
  • 1,608
  • 4
  • 22
  • 27
  • What have you tried? What is a data sample like? Where are you reading it from? All pretty valid things that you don't address here. It basically sounds like "ordered" bulk updates with "upserts", but as to the actual structure, who can say when you don't really show anything? – Blakes Seven Mar 25 '16 at 01:22
  • Take a look at: [Fast or Bulk Upsert in pymongo](http://stackoverflow.com/questions/5292370/fast-or-bulk-upsert-in-pymongo). It's an older question, but has been added to over the years. – Blakes Seven Mar 25 '16 at 01:24

0 Answers0