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?