You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Nils Breunese <N....@vpro.nl> on 2010/08/18 10:37:23 UTC

Modify a field in multiple documents

Hello,

I recently needed to modify a field in some documents in a CouchDB database. Since there were 26000+ of them I didn't want to edit them all via Futon, so I threw together a little Python script with the aid of Couchdbkit.

The code is here: http://gist.github.com/533964

Maybe someone else will find this useful.

The script currently loads all documents at once. For large numbers of documents to update you might need to add some form of pagination. Saving batches of docs to a temporary list and using bulk_save to send the updated docs to CouchDB might also speed up things. Anyway, the current naive approach worked fine for my 26000+ docs.

Nils.

De informatie vervat in deze  e-mail en meegezonden bijlagen is uitsluitend bedoeld voor gebruik door de geadresseerde en kan vertrouwelijke informatie bevatten. Openbaarmaking, vermenigvuldiging, verspreiding en/of verstrekking van deze informatie aan derden is voorbehouden aan geadresseerde. De VPRO staat niet in voor de juiste en volledige overbrenging van de inhoud van een verzonden e-mail, noch voor tijdige ontvangst daarvan.