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>

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?