update doc and db