Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 2898 invoked from network); 5 Nov 2009 19:58:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Nov 2009 19:58:04 -0000 Received: (qmail 57953 invoked by uid 500); 5 Nov 2009 19:58:03 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 57872 invoked by uid 500); 5 Nov 2009 19:58:03 -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 57862 invoked by uid 99); 5 Nov 2009 19:58:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Nov 2009 19:58:03 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of nrstott@gmail.com designates 209.85.218.218 as permitted sender) Received: from [209.85.218.218] (HELO mail-bw0-f218.google.com) (209.85.218.218) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Nov 2009 19:58:01 +0000 Received: by bwz10 with SMTP id 10so395688bwz.35 for ; Thu, 05 Nov 2009 11:57:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=KAxrtuEvkWIJHoDjKOPXJj8n+H9SWPvDuJeYmstz7gU=; b=nGiT5CfSgx0muKD7bHCf7dt+Y6ZSOW9TbIyK8avphzej5RBBnom4uehv3N+9cV4Ub2 jIb0qoQl+RyKTq3XQSdCYkY/lSDgtBDTpYmeLqcKJEhULH00K5U3LYCPV+oi3m1n0MDL EWUayVtHEoPRH9nxPACv4kEdp5fkz2piaoUpE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=doHLLzgpm2IOUjoTL826w8VviIW2XQGv6X7c2NbMJz2zybS5f08fnL0dQ7nr7cp4a2 zyN8OLIcfGgTWkW8ohyvm4i/zzfshSVNjGavUk1/aMZvpApvuSFTttAFMVYEbhthfGvA lT/DlDxTIRg4qRyVUeHShgkal8medR+ENwBHs= MIME-Version: 1.0 Received: by 10.204.154.213 with SMTP id p21mr3491336bkw.163.1257451059315; Thu, 05 Nov 2009 11:57:39 -0800 (PST) In-Reply-To: <31696010-2186-4BCD-9A59-218EAA60844F@devonweller.com> References: <3E00739B-2973-4A13-AF4D-9992A39A6527@devonweller.com> <254CF962-CC02-4FEA-9A60-ECF2E71CA2D2@devonweller.com> <31696010-2186-4BCD-9A59-218EAA60844F@devonweller.com> Date: Thu, 5 Nov 2009 13:57:39 -0600 Message-ID: Subject: Re: Sorting items by number of votes From: Nathan Stott To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0015175cd86eb6b9de0477a523b2 --0015175cd86eb6b9de0477a523b2 Content-Type: text/plain; charset=ISO-8859-1 If you put your votes in array belonging to the resource document, you will run into problems with conflicts if voting occurs near simultaneously on the same resource. On Thu, Nov 5, 2009 at 1:51 PM, Devon Weller wrote: > > Thanks Nathan, Daniel and others. Those are some good suggestions and > workarounds. > > I think I may need to rethink my design and just put the votes in an array > belonging to the resource document. > > > As for the aggregate sum example in the wiki, I still think it might be > broken. I'm starting another thread with details about that in a separate > email. > > - Devon > > > > On Nov 5, 2009, at 12:53 PM, Nathan Stott wrote: > > Right now I'm using lists to do 'joins' of my multi-doc-type views. >> > > On Nov 5, 2009, at 11:43 AM, Daniel Truemper wrote: > > You could however write another type of document (VoteCount) into your >> database containing the resource and the number of votes. Then emitting as >> key something like [ #votes, resource ] will give you an ordered view based >> on the number of votes. You could trigger the view update from the client >> each time a vote is made (i.e. add a vote document, call the view, update >> the VoteCount document and call the new view to get the ordered votes). You >> could also do this automatically on the CouchDB using update notifiers and >> simple Bash/Python/Perl/whatever scripts... >> > --0015175cd86eb6b9de0477a523b2--