Hi,
I'm trying to understand the database model of chat (with MongoDB) because I've a need to purge sometime the global chat.
I understand they are this kinds of object :
// The message with an id, a timestamp and the chat room id
{
"_id" : ObjectId("5a9a80d85626e2b836154d78"),
"_key" : "message:535",
"content" : "Moshi moshi !!!!",
"timestamp" : 1520074968489.0,
"fromuid" : 1,
"roomId" : 5
}
//The link between a message and a user
{
"_id" : ObjectId("5a9a8a945626e2b836155b22"),
"_key" : "uid:10:chat:room:5:mids",
"value" : "539",
"score" : 1520077460459.0
}
//The link between an instance of room and a user
{
"_id" : ObjectId("5a9a80915626e2b836154c46"),
"_key" : "uid:11:chat:rooms",
"value" : "5",
"score" : 1520077460459.0
}
So far so good.
And then, i don't understand the database model with notification.
They are this kind of objects, but I don't understand what i have to delete
{
"_id" : ObjectId("5a9a80d85626e2b836154d99"),
"_key" : "uid:10:chat:rooms:unread",
"value" : "5",
"score" : 1520077460467.0
}
//difference between the : {_key" : "uid:11:chat:rooms", "value" : "5",} ??
{
"_id" : ObjectId("5a9851e6ca66c7f2d7e75c87"),
"_key" : "chat:room:2:uids",
"value" : "9",
"score" : 1519992614981.0
}
And finally :
{
"_id" : ObjectId("5a994004907ed4104cd982bb"),
"_key" : "uid:12:notifications:read",
"value" : "chat_15_2",
"score" : 1519992629517.0
}
Someone can explains me what are the puposes of the three last objects ?
Thanks.