Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 29162 invoked from network); 10 Dec 2010 14:09:08 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 10 Dec 2010 14:09:08 -0000 Received: (qmail 61795 invoked by uid 500); 10 Dec 2010 14:09:05 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 61619 invoked by uid 500); 10 Dec 2010 14:09:05 -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 61598 invoked by uid 99); 10 Dec 2010 14:09:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Dec 2010 14:09:04 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [64.68.200.141] (HELO mailout.easydns.com) (64.68.200.141) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Dec 2010 14:08:58 +0000 Received: from localhost (localhost [127.0.0.1]) by mailout.easydns.com (Postfix) with ESMTP id AB78F34168; Fri, 10 Dec 2010 09:08:26 -0500 (EST) Received: from mailout.easydns.com ([127.0.0.1]) by localhost (mailout-01.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RRp2okW0Ave9; Fri, 10 Dec 2010 09:08:26 -0500 (EST) Received: from [192.168.10.102] (jpfiset.ott.istop.com [66.11.174.172]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailout.easydns.com (Postfix) with ESMTPSA id 860C334165; Fri, 10 Dec 2010 09:08:26 -0500 (EST) Message-ID: <4D023459.9040505@fiset.ca> Date: Fri, 10 Dec 2010 09:08:25 -0500 From: Jean-Pierre Fiset User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Suppressing duplicate documents from a view query X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit This question relates to CouchDb 1.0.1. I have been reading as much as I can about CouchDb and started implementing an application. I seem to remember that there is a request flag that can be passed to a view query to eliminate document duplicates. However, I do not recall which one it is. A quick review of the wiki did not shed any light. Currently, I am removing duplicates by using a list function. I have documented the details of the list function here: http://www.bitsbythepound.com/remove-document-duplicates-from-couchdb-view-query-using-a-list-function-366.html In short, this is the list function: function(head, req) { send('{"total_rows":'+head.total_rows +',"offset":'+head.offset+',"rows":['); var ids = {} ,row ,first = true ; while(row = getRow()) { if( !ids[row.id] ) { if( first ) { first = false; } else { send( ',' ); }; send( toJSON(row) ); ids[row.id] = 1; }; }; send(']}'); } Questions: 1. Is there a much simpler way to achieve this? 2. If the list function is the way to solve the problem, can someone comment on the likelihood that this function will sustain the scaling up of the database? Thanks, JP