Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 91330 invoked from network); 16 Nov 2010 10:05:38 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Nov 2010 10:05:38 -0000 Received: (qmail 19696 invoked by uid 500); 16 Nov 2010 10:06:07 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 19471 invoked by uid 500); 16 Nov 2010 10:06:07 -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 19461 invoked by uid 99); 16 Nov 2010 10:06:06 -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 10:06:06 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sebastiancohnen@googlemail.com designates 209.85.214.52 as permitted sender) Received: from [209.85.214.52] (HELO mail-bw0-f52.google.com) (209.85.214.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Nov 2010 10:05:59 +0000 Received: by bwz4 with SMTP id 4so446206bwz.11 for ; Tue, 16 Nov 2010 02:05:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:subject:mime-version :content-type:from:x-priority:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=3TuI1bJ1HXX8O0Agid+KvJQiX+Pd/XKW7ZP4hp/mi20=; b=kom1E34yNaCuiJR6EgcTq2xK+8/DQiIR3hjEB9Fu/reo5C8rz+S2J25BmzqTDAWFK5 P0Aha8H6GynSoxhLxMlkI04vkkuPw+/aDWCTu/YH7eGoB1bO0Awx02gE0+/EOZ/k6QLe SdyCtK5tyhp/qD3fL9BrGOrg6P/bSh0ZBfm9I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=subject:mime-version:content-type:from:x-priority:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=woK1EOYq76HPs9Mcx7vjn/lguMB49IoKJI+6hgenFfvIgLum4xm7O0eH0CvAETJtvW t6RcPteMaautmd0PGk79aM4VkQbi0/LGd1dz4bKy08Z1b/KHl5migcwzdYsdILn0lmWA FrrKWUxX7XpRsl5gnD89hMpnQdUdOPMqxfqmI= Received: by 10.204.120.67 with SMTP id c3mr7023619bkr.174.1289901938141; Tue, 16 Nov 2010 02:05:38 -0800 (PST) Received: from shakti.fritz.box (koln-5d81527e.pool.mediaWays.net [93.129.82.126]) by mx.google.com with ESMTPS id t10sm482460bkj.4.2010.11.16.02.05.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 16 Nov 2010 02:05:35 -0800 (PST) Subject: Re: Bulk Updates in CouchDB Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Sebastian Cohnen X-Priority: 3 (Normal) In-Reply-To: <318929060.20101116204449@surfulater.com> Date: Tue, 16 Nov 2010 11:05:33 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <816D2FBA-BEC9-49E8-8B74-4C2756712840@googlemail.com> References: <1366718319.20101116140122@surfulater.com> <318929060.20101116204449@surfulater.com> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1082) X-Virus-Checked: Checked by ClamAV on apache.org You can update documents in batches. but in order to update them - = deletion is also an update in that case - you need to provide the = document, or, in case of deletion, at least the correct _rev token. so = you would need to collect the _rev tokens and IDs of the docs you want = to delete, batch them up and send one request to the server. On 16.11.2010, at 10:44, Neville Franks wrote: > 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. >=20 > 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. >=20 > 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. >=20 >=20 > Tuesday, November 16, 2010, 2:06:18 PM, you wrote: >=20 > k> You can't do this at the moment. At least, not that I know of. >=20 > k> For #1, my current trick is to generate a view with a map function > k> that looks like this: >=20 > k> map: function(doc) { > k> emit(null, doc._rev); > k> } >=20 > k> This makes it easy to convert the results of the view (without > k> stale=3Dok) 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. >=20 > k> For #2, you have to iterate over from the client side. Unless, = someone > k> else has another idea. >=20 > k> K. > k> --- > k> http://www.pcapr.net > k> http://twitter.com/pcapr > k> http://labs.mudynamics.com >=20 > 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. >>>=20 >>> 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. >>>=20 >>> My question is how do I do some simple things like: >>>=20 >>> 1) Delete all documents where key.value =3D xxx >>>=20 >>> 2) Update all documents where key.value =3D xxx so value =3D yyy >>>=20 >>> I want the DB to do these, not for me to have to iterate through the >>> DB in code. =46rom what I've read about Views, they are read-only = and >>> therefore can't be used in update/delete operations. >>>=20 >>> 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. >>>=20 >>> 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. >>>=20 >>> Hopefully I'm missing something obvious. >>>=20 >>> --- >>> Neville Franks, http://www.surfulater.com >=20 > Neville Franks, http://www.surfulater.com >=20