I am considering using CouchDB for an upcoming site, but I have yet to implement a little A system of user ratings for a site that is confused, in fact, each item of the content can be evaluated by a given user. How does this make the most sense in the CouchDB model? I think there should be 3 different document types, content, users, and a user_rating doctor in the DRYest and most logical manner that looks like this.
Then, I will create a scene where the map was a set of all content docs and inserted by the content doctor ID Gone docs, and where low, the ratings mean less and the content dock made by return content dock id.
Is that the best way to do this? I have not yet found much in the way of resources on CouchDB's best practices, so I am very uncertain about all these things.
My conclusion: The answer accepted below, which I was going to run was going to work too much, but beware, the docs need to be closed from the content doc id Document creates advanced queries compared to property. I am going back to SQL for my needs in this app.
Looks like you're having proper ideas CouchDB is so new that I think it's the best Practices will take a while.
Reduce a map / pair of this type can be a proper starting point.
map:
function (doctor) {if (doc.type = 'rating' & amp; amp; amp; amp; amp; doc.content_id) { Emit (doc.content_id, doc.rating); }}
decrease:
function (keys, values) {return sum (value) /values.length}
NB: This map
function needs to add the appropriate type to your rating
model:
{type: 'rating ', User_id: "USERID", content_id: "CONTENTID", rating: 6}
Comments
Post a Comment