couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: Pruning a couchdb database
Date Mon, 27 Sep 2010 15:31:49 GMT
On Mon, Sep 27, 2010 at 11:26 AM, John Logsdon
<john.logsdon@netdev.co.uk> wrote:
> Hi
>
> I need to hold, potentially, millions of call records in a couchdb cluster
> and using a management process periodically truncate the records based on
> their age. I can see how I can get the Set of matching records using a View
> but how do I delete them in the same operation? My understanding is that I
> can only GET from a View so I cant see how to do this without bringing the
> data back to the client and issuing a DELETE for each record which would be
> a real problem wrt performance.
>
> Regards
>
> John
>

John,

You can't GET and DELETE in a single operation in CouchDB. Although,
you can avoid using a DELETE per document by using the _bulk_docs API.

If you PUT (or use _bulk_docs) with a document that looks like:

{"_id": "docid", "_rev": "prev-revision", _deleted: true}

It'll delete that document. Doing that with _bulk_docs will let you
batch DELETE's together.

HTH,
Paul Davis

Mime
View raw message