I am afraid that this is an ongoing problem. I had the same problem and I found a jira ticket about this:
https://jira.mongodb.org/browse/SERVER-14322
It is possible that two updates come in with upsert:true, resulting in neither finding a document and both inserting new documents which conflict on unique index violations of the query predicate.
The “solution” here is to add a retry code into the client.