I need to create a messaging system where a person can talk with many users. For example, I start talking with user2, user3 and user4, so any of them can see the whole conversation, and if the conversation is not private at any time, any of the participants can add any other person to the conversation.
Here is my idea how to do this. I use Mongo, and my idea is to use the dialog as an instance instead of a message.
The scheme is indicated as follows:
{ _id : ...., // dialog Id 'private' : 0 // is the conversation private 'participants' : [1, 3, 5, 6], //people who are in the conversation 'msgs' :[ { 'mid' : ...// id of a message 'pid': 1, // person who wrote a message 'msg' : 'tafasd' //message }, .... { 'mid' : ...// id of a message 'pid': 1, // person who wrote a message 'msg' : 'tafasd' //message } ] }
I see some pros for this approach - in a large database it will be easy to find messages for a specific conversation. - It will be easy to add people to the conversation.
but here is a problem for which I canโt find a solution: the conversation gets too long (take skype as an example) and they donโt show you the whole conversation, they show you a part and then show you additional messages. In other situations, skip, the limit resolves the matter, but how can I do it here?
If this is not possible, what suggestions do you have?
Salvador dali
source share