add query and put doc and delete