Don’t alter the RETURN type for CREATE / UPDATE / DELETE / RELATE / INSERT / UPSERT statements. Not only does this cause unexpected behaviour, but it also altered the statement from multiple goroutines, and therefore caused a data race.
We don’t need to check whether the record already exists, as we always have any record contents when we are procesing a document. Therefore we already know if a document exists or not in the kv store.