couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Blakey <antony.bla...@gmail.com>
Subject Re: include_docs=true on _all_docs_by_seq - Suggested Fix
Date Thu, 13 Nov 2008 12:02:24 GMT

On 13/11/2008, at 9:48 PM, Antony Blakey wrote:

>
> On 13/11/2008, at 9:22 PM, Antony Blakey wrote:
>
>> When you set include_docs=true on _all_docs_by_seq, it doesn't  
>> provide the deleted entries that it otherwise does. It would be  
>> useful for external code that e.g. maintains an alternative index,  
>> if entries for the deleted documents were returned, although  
>> without the document.
>
> Actually, that's misleading - it crashes. I didn't notice because  
> only my last record is deleted.

Modifying couch_httpd_view:view_row_obj like this:

   case (catch couch_httpd_db:couch_doc_open(Db, DocId, Rev, [])) of
     {{not_found, missing}, _} ->
       {[{id, DocId}, {key, Key}, {value, Value}, {error, missing}]};
     {not_found, deleted} ->
       {[{id, DocId}, {key, Key}, {value, Value}]};
     Doc ->
       JsonDoc = couch_doc:to_json_obj(Doc, []), {[{id, DocId}, {key,  
Key}, {value, Value}, {doc, JsonDoc}]}
   end;

fixes the crash, and allows the entries to be returned.

Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Plurality is not to be assumed without necessity
   -- William of Ockham (ca. 1285-1349)



Mime
View raw message