I have a list that has some basic authentication on a document. The issue I am having is that the list is caching so the user will not see they have access unless I update the revision id. How do you show a non-cached list?
if (req.userCtx.name === doc.permissions.owner) {
return 'you have permission';
}
else {
return 'you do not';
}
How I would imagine it done is by passing no-cache or update the ETAG or something of that sort in the header, but nothing seems to work. Here is an attempt I have that sends a new date in the head every time to make it not cache, but this doesn't work.
var date = new Date().getTime() + 'x';
start({code: 200, headers: {'Content-Type': 'text/html', 'date': date}});
Any ideas greatly appreciated!
By the way I am looking for a pure couch solution.
So after a lot more digging I found this:
http://wiki.apache.org/couchdb/Formatting_with_Show_and_List#ETags
Cutting to the important parts:
Hope this helps someone.
Fortunately CouchDB sources are available! I was able to find this algorithm in
couch_mrview_show.erl
:Here we could see that Shows are cached unless one of the following things changed: