anchor.diff:              Doc
       end,
       DocId = Doc2#doc.id,
  -    case couch_httpd:qs_value(Req, "batch") of
  -    "ok" ->
  -        % async_batching
  -        spawn(fun() ->
  -                case catch(couch_db:update_doc(Db, Doc2, [])) of
  -                {ok, _} -> ok;
  -                Error ->
  -                    ?LOG_INFO("Batch doc error (~s): ~p",[DocId, Error])
  -                end
  -            end),
  -            
  -        send_json(Req, 202, [], {[
  -            {ok, true},
  -            {id, DocId}
  -        ]});
  -    _Normal ->
  -        % normal
  -        {ok, NewRev} = couch_db:update_doc(Db, Doc2, []),
  -        DocUrl = absolute_uri(
  -            Req, binary_to_list(<<"/",DbName/binary,"/", DocId/binary>>)),
  -        send_json(Req, 201, [{"Location", DocUrl}], {[
  -            {ok, true},
  -            {id, DocId},
  -            {rev, couch_doc:rev_to_str(NewRev)}
  -        ]})
  -    end;
  -
  +    update_doc(Req, Db, DocId, Doc2);
   
   db_req(#httpd{path_parts=[_DbName]}=Req, _Db) ->
       send_method_not_allowed(Req, "DELETE,GET,HEAD,POST");
  
positive.code:     {[{id, DocId}, {error, ErrorStr}, {reason, Reason}]}.
  
  
  update_doc(Req, Db, DocId, Doc) ->
      update_doc(Req, Db, DocId, Doc, []).
  
  update_doc(Req, Db, DocId, Doc, Headers) ->
      update_doc(Req, Db, DocId, Doc, Headers, interactive_edit).
  
  update_doc(Req, Db, DocId, #doc{deleted=Deleted}=Doc, Headers, UpdateType) ->
      case couch_httpd:header_value(Req, "X-Couch-Full-Commit") of
  
negative.code:     DocEdited = Doc#doc{
          atts = NewAtt ++ [A || A <- Atts, A#att.name /= FileName]
      },
  
      Headers = case Method of
      'DELETE' ->
          [];
      _ ->
          [{"Location", absolute_uri(Req, "/" ++
              ?b2l(Db#db.name) ++ "/" ++
              ?b2l(DocId) ++ "/" ++
              ?b2l(FileName)
          )}]
      end,
      update_doc(Req, Db, DocId, DocEdited, Headers);
  
  db_attachment_req(Req, _Db, _DocId, _FileNameParts) ->
      send_method_not_allowed(Req, "DELETE,GET,HEAD,PUT").
  