incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Stott <nrst...@gmail.com>
Subject Re: Sorting items by number of votes
Date Thu, 05 Nov 2009 19:57:39 GMT
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 <dweller@devonweller.com>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...
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message