Don't ignore doc_as_upsert value and simplify. Closes #3265

This simplifies the code and should close #3265