couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damien Katz <dam...@apache.org>
Subject Re: couch_db:delete_doc/3
Date Thu, 28 Apr 2011 01:55:54 GMT
If it's not called, removed it!


-Damien



On 4/27/11 6:29 PM, "Randall Leeds" <randall.leeds@gmail.com> wrote:

>couch_db:delete_doc/3 isn't actually used anywhere by any code I could
>find.
>
>However, I just tried to use it in an etap test and found it a bit
>strange:
>
>delete_doc(Db, Id, Revisions) ->
>    DeletedDocs = [#doc{id=Id, revs=[Rev], deleted=true} || Rev <-
>Revisions],
>    {ok, [Result]} = update_docs(Db, DeletedDocs, []),
>    {ok, Result}.
>
>I think that's got to be horribly broken because revs should not be a
>list but {Pos, [RevList]}, no?
>Something more like this maybe right?
>
>delete_doc(Db, Id, Revisions) ->
>    DeletedDocs = [#doc{id=Id, revs={Pos, [Rev]}, deleted=true} ||
>{Pos, Rev} <- Revisions],
>    {ok, [Result]} = update_docs(Db, DeletedDocs, []),
>    {ok, Result}.
>
>I'm not really sure how this was intended to work.
>Maybe:
>
>delete_doc(Db, Id, Revisions) ->
>    DeletedDocs = [#doc{id=Id, revs=Revs, deleted=true} || Revs <-
>Revisions],
>    {ok, [Result]} = update_docs(Db, DeletedDocs, []),
>    {ok, Result}.
>
>Weigh in please :)



Mime
View raw message