Hi, I am new to CouchDB's world too...
Is there a tutorial about best practices for structuring of documents?
It is so much diffnrent from what I have already done that I don't want
to "start with the wrong foot"
I have read a lot of examples, but I feel a lack some basic
understanding of what trade-ofs may be involved!
Thanks,
Alain
=== Minha MesaXYZ: <http://mesa-reprap.blogspot.com.br/> ===
Em 26-09-2013 14:06, Filippo Fadda escreveu:
Hello Ashraf,
in CouchDB doesn't exist the concept of table or entity, as you can find in the
entity relational model. Everything is a document in CouchDB, that means both
student and message are documents. Here you have two different document types:
student and message. So, in your model, you have to add a new property called
'type' to distinguish between a student and a message.
You don't need to GET the student, you just need to store a new document to
save your message for him.
Here the student document structure:
_id
_rev
type: 'student'
name
age
Here the message document structure:
_id
_rev
type: 'message'
senderId
recipientId
title
body
I think you can understand the meaning of each property yourself.
-Filippo
On Sep 26, 2013, at 6:48 PM, Ashraf Janan wrote:
Hi,
Please :
I have a document field : Student with :_id, _rev , name: "Tom" , age : "37"
and i want to send message to Tom
* Can do please check if my steps are correct ?
1- i must to use Get method to get Tom document
2- then i will use Put method to send a message , in this case must i have the
_id,_rev,name,age + message
in the JSON form of that student.
* If i have the _id only for a student Tom,
Can i send a message to Tom direct?
* Why i need to get all the fields in the Document Student to send a message ?
Best regards
Ashraf