I am currently trying to develop a random chat application which matches users randomly and allows them to chat and then add each other as friends (if they enjoyed the chat) in order to continue the chat.
So now I need to solve three problems:
- match users randomly
My idea would be to implement a method which randomly picks two user ids from my users collection. But I do not know how to implement this in code - Can anybody help here?
- craete a chat room to store the messages
This is the most difficult part. Currently my idea is to create a collection called "chats" and add a document which is named "$uid of user 1 & $uid of user2" where I save the messages. But I do not know how that would look in code and whether this actually solves the problem.
- create a friend list
My idea is to create a list inside each user document and save the user ids of all friends. How could that be implemented in code? And is there a better solution to that?