-
Notifications
You must be signed in to change notification settings - Fork 1
Data model
Any changes in document will be propagated by message structure with action msg:
{
id: 204551347a1489f70f38ddb5 // document id in hex
action: "msg"
op: { // operation structure
type: ‘i’ // insert (i), remove (r)
pos: 42 // position in file
text: ‘f’ // text for insert
}
}
Download entire document content after load file(subscribe to proper channel) returned in message structure with action doc:
{
id: 204551347a1489f70f38ddb5 // document id in hex
action: "doc"
text: "<p>Ala ma kota...</p>"
}
Message recieved from server after someone has changed document content while being in offline mode (those who are online are replacing their content and are shown a proper message) - action doc:
{
id: 204551347a1489f70f38ddb5 // document id in hex
action: "doc"
text: "<p>Ala ma kota...</p>"
override_warning: true
}
Download list of documents by message structure with action list:
{
action: "list"
}
Returned in message structure with action list:
{
action: "list"
files: [
{ id: 204551347a1489f70f38ddb5, name: "global" }, // structure representing document with id and name
{ id: 204551347aff29f70f38ddb5, name: "Sample1" }
]
}
Document representation in mongo database:
{
_id: ObjectId("551347a1489f70f38ddb5126") // document id
last_change: ISODate("2015-04-11T13:08:25.222Z")
text: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras non justo tellus.</p>"
priv: true // true or false
}
Saving document and creating new document operation is supported by message structure with action save, for creation of new documents, it's needed to pass "<p><br></p>" for text value instead of document content:
{
action: "save"
name: "Doc1"
text: "<p>Ala ma kota...</p>"
priv: false
}
After successful document save or creation, server will return message with action save:
{
action: "save"
name: "Doc1"
id: 204551347a1489f70f38ddb5 // document id in hex
}