Fixed document already exists error when concurrently sending update request with upsert using the same id.

Closes #2530