CouchDB Blog Application -


I have read many articles on "CouchDB - Definitive Guide" and on the Web I understood how the couch works, but Some questions are still in my mind.

To work on a simple blog application: I want to show the post data and the author's data in the post page. So I think I have to give everything in the same document. Fine. If I need to show only the author's data in a page, then I can do it with a view okay.

But if the author updates his data, then I need to update every document where the authors appear? Or am I wrong?

I love to understand this argument.

Thanks in advance.

Some information can be left in the same document, and in most cases that will work just fine.

  {"title": "Blog Article Title", "Content": "... Blah Blah Blow ...", "Author": {"Name": "Some Guys" , "Email": "someguy@foo.bar"}, "type": "post"}   

The second time you create a link between 2 documents _id .

  {"_id": "...", "title": "blog paragraph title", "content": "... blah blah blah ...", "author" : "Someguy", "type", "post"} {"_id": "someguy", "name": "some boys", "email": "someguy@foo.bar", "type": "author"}   

At first glance, you will need 2 different questions to recover the two organizations. However, there is a good small move, which can see the queries.

  function (doctor) {if (doc.type === "post") {emit ([doc.title, 0], zero); // output main post emissions ([doc.title, 1], {_id: doc.author}); // output author}}   

Your result will give this result: (note how it is sorted)

  {... "rows" { {"Blog paragraph title", 0], "value": blank, {"key": ["blog paragraph title", 1], "value": {"_id": "someguy"}}] }   

This is not useful at all, but if you add your code to include_docs = true , you will get the result: "{{" key " : ["Blog Article Title", 0], "Value": Empty, "Doctor": {"_id":

  {...} "...", "title": "blog article title", "content": "... blah blah blah ...", "author": "someguy", "type": " "" "": "", "Name": "some people" ["blog paragraph title", 1], "value": {"_id": "someguy"}, "doctor": {"_id": "someguy" "," email ":" someguy@foo.bar "," type ":" authors "}}]}   

Has been included in :)

For more information about institution relations in CouchDB, see.

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -