incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svilen ...@svilendobrev.com>
Subject Re: Tracking doc access
Date Fri, 15 Mar 2013 07:40:28 GMT
+1
as for the id: think multiple accesses at *same* time, for same user from diff.
machines/devices/browser/session-in-browser. in theory all those can be
same, but that's still 2 acceses.

On Fri, 15 Mar 2013 02:23:59 +0000
Jim Klo <jim.klo@sri.com> wrote:

> One more thing… inserting new doc is also not prone to document
> conflicts since you're not updating a document when logging access
> from multiple threads.
> 
> - JK
> 
> On Mar 14, 2013, at 7:13 PM, Jim Klo <jim.klo@sri.com>
>  wrote:
> 
> > I think you'd be better off tracking access by inserting an
> > immutable document with a new timestamp and doc._id of the accessed
> > document.
> > 
> > You could then create a view that 'joined' the timestamp doc with
> > real doc, by emiting timestamp as key and { _id: accessed_doc._id }
> > as the value then requesting with_docs=true if I remember
> > correctly… 
> > 
> > Updating doc to append a timestamp would be inherently slow if you
> > have a high volume of repeat access and cause your views to
> > consistently have to update…
> > 
> > just my 2¢
> > 
> > - Jim
> > 
> > Jim Klo
> > Senior Software Engineer
> > Center for Software Engineering
> > SRI International
> > t.	@nsomnac
> > 
> > On Mar 14, 2013, at 5:56 PM, Stephan Bardubitzki
> > <stephan@bardubitzki.com> wrote:
> > 
> >> Hi there,
> >> 
> >> I have a task where I need to track how often a doc is accessed.
> >> The two possible ways I can think of are:
> >> 
> >> 1. add an array to the doc and add the timestamp when it is
> >> accessed 2. create a new document and add the doc._id and the
> >> timestamp
> >> 
> >> Which one would you prefer? Or is there a better solution?
> >> 
> >> Thanks,
> >> Stephan
> >> 
> > 
> 

Mime
View raw message