Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 70907 invoked from network); 14 Apr 2008 00:34:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Apr 2008 00:34:32 -0000 Received: (qmail 76388 invoked by uid 500); 14 Apr 2008 00:34:32 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 76362 invoked by uid 500); 14 Apr 2008 00:34:32 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 76351 invoked by uid 99); 14 Apr 2008 00:34:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Apr 2008 17:34:32 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ralf.nieuwenhuijsen@gmail.com designates 209.85.146.180 as permitted sender) Received: from [209.85.146.180] (HELO wa-out-1112.google.com) (209.85.146.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Apr 2008 00:33:47 +0000 Received: by wa-out-1112.google.com with SMTP id n4so1922613wag.6 for ; Sun, 13 Apr 2008 17:34:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=NEthJqswydqO4mXgNUbKcZS+mKF0h7kL/09vEkcoDE8=; b=HR+F+nP6ye0/k2J5/PbKsA/80hXO0V5erfkrjQVwYKb4e08q6s2VSxkee7KNiK9V0LdCa7go+KhLxANWQZH+8A09BVWkMT+KiuSe7kqnz27RzyDSzKD6rdtKU2+Qby/J4wCHbkYiP2G4VtP0Bki7lvfyr5nKlE63mmzBq/m/fKU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=cxuD+5iKVbhROkNf9kxyqa2qgFBoqZWOHEhSyexaSh8tRkCzr9pXhKnNOLc6Wz5VQ881YGWDj9CnG18T10r4wu3jgr63SuqrDR33GT1DyhZCnsSjs+yU+tLJfn6FM0MN9Ek0bYHNUWvpOTM9ceNgGxLeSJU6CE7HR4UaEQiTZf0= Received: by 10.114.109.1 with SMTP id h1mr6199230wac.35.1208133240288; Sun, 13 Apr 2008 17:34:00 -0700 (PDT) Received: by 10.115.88.16 with HTTP; Sun, 13 Apr 2008 17:34:00 -0700 (PDT) Message-ID: <41fe564f0804131734m276a9a1ah1d4e815c54f95599@mail.gmail.com> Date: Mon, 14 Apr 2008 02:34:00 +0200 From: "Ralf Nieuwenhuijsen" To: couchdb-user@incubator.apache.org Subject: Re: Create a view with only unique records In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_37432_27125569.1208133240238" References: <41fe564f0804122043x6d79e619t20c228f906fe0820@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_37432_27125569.1208133240238 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Well, that doesn't really apply. I am not looking for way to create unique documents. I'm looking for a way to get a view with only unique documents. Imagine some portion of all the documents having the key 'adres'. Then I want a list of unique adresses; a view with only the adres keys for documents that have it, and then only unique entries. It seems currently i can solve this problem in two ways: - creating a separate adres document that stores an array of all unique addresses. But without any sane default merging behavior, this breaks at replication. - creating a separate document for _each_ adres using put and the md5 of the adres of doc-id. This seems like an enormous waste of space. Esspcially since I will be doing this with almost every key in every document. In the future this should be doable with the reduce/combinator behavior, i expect.But even there, i think the suggested approach is too limiting. The reducer is going to return one json object. I would rather have it emit (key,value) and use default view operations on it for stuff like pagination. Using the above example and assuming the reducer is implemented. How to get the X most used addresses? the value of X needs to be hard-coded with the suggested implemenation. Whereas using emit(key,value) in the reducer as well, would allow for pagination. Greetings, Ralf 2008/4/13, Chris Anderson : > > Ralf, > > If you use an algorithm to generate a deterministic _id for records > before PUT-ing them to CouchDB, you can ensure that each unique record > only appears once in the database. This discussion might be relevant > for you: > > > http://mail-archives.apache.org/mod_mbox/incubator-couchdb-user/200803.mbox/%3Ce282921e0803161811s4a98a946tc061be37766c7618@mail.gmail.com%3E > > Chris > > > On Sat, Apr 12, 2008 at 8:43 PM, Ralf Nieuwenhuijsen > wrote: > > Is it possible to create a view with only unique-records? > > I assume it would be possible using the future reduce/combinator > behavor? > > > > What time-frame is the reduce-behavior planned? > > > > Greetings, > > Ralf > > > > > > > -- > Chris Anderson > http://jchris.mfdz.com > ------=_Part_37432_27125569.1208133240238--