The issue in couchdb is that we need to distinguish a database footer
(which contains the positions of the roots of the by_id and by_seq
trees, etc) from one inside an attachment. One way to avoid this is to
use one file for documents and another for attachments. If TouchDB is
effectively doing that, then that explains how you escape the issue.

On 23 March 2012 16:43, Jens Alfke <[email protected]> wrote:
>
> On Mar 23, 2012, at 6:35 AM, Volker Mische wrote:
>
>> You are right. It won't be raw JSON, but it can be way closer to that
>> (hence less processing needed for sending it out) than it currently is
>> the case.
>
> TouchDB* stores document contents as raw JSON without the special 
> (underscored) properties like _id, _rev, _attachments. When serving a 
> document it re-inserts those properties based on document metadata; but it 
> splices them into the document body data before the closing ‘}’, so it 
> doesn’t have to parse the document JSON.
>
> (There are cases where it has to parse the document, but not on a basic GET.)
>
> —Jens
>
> * https://github.com/couchbaselabs/TouchDB-iOS

Reply via email to