I’m using Java driver 3.12 and facing the following issue:
I’m trying bulk insert a huge amount of documents with a retry mechanism in case there is connection disruption issue. The problem is, once the retry kicks in, it starts the bulk insert all over again. Since there are some documents have been inserted in previous try, it results in “Duplicate Key error”.
My question is that is there a way to ignore the “duplicate key error” in subsequent retry ?
Update: I have a follow-up question. The above problem can be solved using “Upsert” opertation instead of “Insert” (using Replace model instead of Insert model in the bulk write). But performance is an important factor here (dealing with ~ 100k records) and my assumption is “Upsert” is significantly more expensive than “Insert”. Is that assumption valid ?