Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 76450 invoked from network); 16 Nov 2010 09:45:07 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Nov 2010 09:45:07 -0000 Received: (qmail 97893 invoked by uid 500); 16 Nov 2010 09:45:37 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 97663 invoked by uid 500); 16 Nov 2010 09:45:37 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 97655 invoked by uid 99); 16 Nov 2010 09:45:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Nov 2010 09:45:37 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [207.58.155.150] (HELO vps.myquickref.com) (207.58.155.150) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Nov 2010 09:45:30 +0000 Received: from ppp118-209-78-176.lns20.mel4.internode.on.net ([118.209.78.176] helo=[192.168.1.40]) by vps.myquickref.com with esmtp (Exim 4.69) (envelope-from ) id 1PII68-0000xq-Tr for user@couchdb.apache.org; Tue, 16 Nov 2010 04:45:09 -0500 Date: Tue, 16 Nov 2010 20:44:49 +1100 From: Neville Franks Reply-To: custsupport@surfulater.com Organization: Soft As It Gets Pty Ltd X-Priority: 3 (Normal) Message-ID: <318929060.20101116204449@surfulater.com> To: user@couchdb.apache.org Subject: Re: Bulk Updates in CouchDB In-Reply-To: References: <1366718319.20101116140122@surfulater.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.myquickref.com X-AntiAbuse: Original Domain - couchdb.apache.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - surfulater.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Checked: Checked by ClamAV on apache.org Thanks for the prompt response. I have to say that I am very, very surprised that what seems to me are such basic operations aren't available natively within CouchDB. This is probably a deal breaker for my use and I would have thought many others. My concern is iterating over a large number of documents on a remote server just to do simple updates. It means I need to do several HTTP requests (GET/PUT/DELETE) for each document in a set of of possibly thousands or tens of thousands. I'm in Australia and the server is in the US and I would imagine this making an application unusable. I am getting the feeling that CouchDB is great for storing lots of information and getting it back in lots of interesting ways but not a good fit for typical CRUD stuff that's done in SQL all the time. Please correct me if I'm wrong. Tuesday, November 16, 2010, 2:06:18 PM, you wrote: k> You can't do this at the moment. At least, not that I know of. k> For #1, my current trick is to generate a view with a map function k> that looks like this: k> map: function(doc) { k> emit(null, doc._rev); k> } k> This makes it easy to convert the results of the view (without k> stale=ok) into a bulk-delete by iterating over the view, but not k> fetching each document to get at the revision. This does mean that the k> documents haven't been updated between the view-fetch and the k> bulk-delete. But for my use-case, this works. k> For #2, you have to iterate over from the client side. Unless, someone k> else has another idea. k> K. k> --- k> http://www.pcapr.net k> http://twitter.com/pcapr k> http://labs.mudynamics.com k> On Mon, Nov 15, 2010 at 7:01 PM, Neville Franks wrote: >> Hi, >> I am just learning about CouchDB so please excuse this nooby question. >> >> I've read lots the past few days including >> http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API and a fair bit >> of two of the online CouchDB books. >> >> My question is how do I do some simple things like: >> >> 1) Delete all documents where key.value = xxx >> >> 2) Update all documents where key.value = xxx so value = yyy >> >> I want the DB to do these, not for me to have to iterate through the >> DB in code. From what I've read about Views, they are read-only and >> therefore can't be used in update/delete operations. >> >> I've read lots on views and CouchDB seems great at getting information >> out in all sorts of ways, however basic bulk update/delete operations >> are so far alluding me. >> >> My main exposure to DB's at this time is using SQLite and these sorts >> of things are of course easy and quick to do in SQL. >> >> Hopefully I'm missing something obvious. >> >> --- >> Neville Franks,  http://www.surfulater.com Neville Franks,  http://www.surfulater.com