incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randall Leeds <randall.le...@gmail.com>
Subject Re: Iterating all documents
Date Wed, 06 Jul 2011 23:45:20 GMT
On Wed, Jul 6, 2011 at 16:41, Matthias Eck <matthias.eck@jibbigo.com> wrote:
> Hello,
>
> I need to add a new field to all documents in my database.
>
> To have a better control I wanted to do this by batches and defined 2 views:
> documents_without_newfield
> documents_with_newfield
>
> My idea was to just take the first 100 returned by the
> documents_without_newfield view, calculate the new field for all of
> them, save them and take the next 100 etc.
>
> As it turns out the views do not seem to be updated immediately, which
> means that the view documents_without_newfield returns about 95
> documents that actually already had the new field calculated in the
> previous step.

If you do not include "stale=ok" with your query, you should get
up-to-date views.
Though, perhaps view groups only update to the latest stable commit on
the database.
In that case, you should be able to get what you want by POSTing to
/_ensure_full_commit or setting the X-Couch-Full-Commit: true header
on your request to update the documents.

Mime
View raw message