anchor.diff:      {[{id, DocId}, {error, ErrorStr}, {reason, Reason}]}.
   
   
  +update_doc(Req, Db, DocId, #doc{deleted=false}=Doc) ->
  +    Loc = absolute_uri(Req, "/" ++ ?b2l(Db#db.name) ++ "/" ++ ?b2l(DocId)),
  +    update_doc(Req, Db, DocId, Doc, [{"Location", Loc}]);
   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).
  +    #doc_query_args{
  +        update_type = UpdateType
  +    } = parse_doc_query(Req),
  +    update_doc(Req, Db, DocId, Doc, Headers, UpdateType).
   
   update_doc(Req, Db, DocId, #doc{deleted=Deleted}=Doc, Headers, UpdateType) ->
       case couch_httpd:header_value(Req, "X-Couch-Full-Commit") of
  
positive.code:     DocEdited = Doc#doc{
          atts = NewAtt ++ [A || A <- Atts, A#att.name /= FileName]
      },
      {ok, UpdatedRev} = couch_db:update_doc(Db, DocEdited, []),
      #db{name=DbName} = Db,
  
      {Status, Headers} = case Method of
          'DELETE' ->
              {200, []};
          _ ->
              {201, [{"ETag", "\"" ++ ?b2l(couch_doc:rev_to_str(UpdatedRev)) ++ "\""},
                 {"Location", absolute_uri(Req, "/" ++
                  binary_to_list(DbName) ++ "/" ++
                  binary_to_list(DocId) ++ "/" ++
                  binary_to_list(FileName)
              )}]}
          end,
      send_json(Req,Status, Headers, {[
          {ok, true},
          {id, DocId},
          {rev, couch_doc:rev_to_str(UpdatedRev)}
      ]});
  
  db_attachment_req(Req, _Db, _DocId, _FileNameParts) ->
      send_method_not_allowed(Req, "DELETE,GET,HEAD,PUT").
  
negative.code:     Doc#doc{id=DocId, revs=Revs2};
  couch_doc_from_req(Req, DocId, Json) ->
      couch_doc_from_req(Req, DocId, couch_doc:from_json_obj(Json)).
  
  % Useful for debugging
  % couch_doc_open(Db, DocId) ->
  