No I'm not. "Entry" is another document type. The comment contains the key to the corresponding entry...
The code above is a bit reduced, because I primarily wanted to know whether the feature is implemented. Sadly it's not!
In JS my view would look like this:
function map(doc) {
if(doc.type == comment)
emit([doc.author], {_id: doc.entry_id})
}I would query this view with the "include_docs" and "key" parameters to get all "entry" documents that were commented by the author (string) provided in the key.
--
A bit of background information: I'm doing a case study of NoSQL databases for embedded systems. It's a non-term job at the university and my first experience working with CouchDB/TouchDB and a document-oriented database for that matter. I'm aware that my implementation is somewhat derived from a relational approach and that I could just store the comments in the corresponding entry documents. But as I said, this is meant to be a small and easy case study to demonstrate several ways it can be done. And I guess that the "store everything in one document" wouldn't be suitable for most real-world models.
I'd appreciate your thoughts that!
Thanks!!