Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes that would work. You could go a bit further, though:

Set your view to emit keys this way:

  [user,message_id]
you can query the view using:

  msgview?startkey=[user]&endkey=[user,{}]
which will give you all the messages for the given user, or

  msgview?startkey=[user,message_id]&limit=1
for a specific message.

Then your list doesn't have to go through all the messages for all the users -- just the ones that the view returned -- and only check that their user info is correct (i.e. nobody's calling the list using an inapropriate view).

With this scheme you could have the same list + view return a specific message as well.

Oh, and definitely go check CouchDB 1.0 -- it's changed quite a bit since 0.7. You can get a hosted version to play with at http://www.couch.io/get.



Thank you!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: