fix bug: update function not check unique due to set_doc is picked up after validate when updating doc