couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filippo Fadda <>
Subject Re: show/list
Date Fri, 15 Nov 2013 02:44:37 GMT

On Nov 15, 2013, at 3:06 AM, Alexander Shorin wrote:
> It's always possible to imagine situation when some tool will be
> useless and some other handy and good (: CouchApp is no more, but
> group of design functions as single logical application, that CouchDB
> easily hosts and able to execute by users request. To interact with
> other system or remote services you may use external handlers. To run
> custom background services os_daemons helps much. All these are
> CouchDB features that could be used to solve specific problem. Not
> sure why you're trying to avoid them all.

I'm not trying to avoid them, at least not all of them.

> While votes are ok

Votes are OK, but you can't use a show handler to generate the HTML that renders the article
properties (title, body, etc.) and the sum of his votes. Instead, working with ElephantOnCouch
(or any other clients) you can do that. And you can join documents even if they haven't a
score, because ElephantOnCouch (only it) returns records for keys don't match any documents.
And this is free, it's just a query option. I want add this feature to CouchDB also, but since
I'm an Erlang noob, I found easier implement it in my library.

> , but having article hit as document isn't wise
> approach: to note why share your app url on /. , /r, hn or other
> resource which could generate a lot of hits - you'll quite soon
> realise that some front-end proxy required to buffer updates and
> forward them to CouchDB as bulk update.

You don't need that. In the Article class there is method named getHitsCount() that query
Redis (using the document id) and returns the impressions count. As I wrote in the mailing
list, ElephantOnCouch saves objects and recreates their instance when you get them with the
getDoc() method. This is an elegant approach. Actually Article is a subclass of Post, etc.

> But this open doors for you also to rich php library set which may be
> quite useful, right?

Maybe. :-)

View raw message