actually my firestore collection look like this:
user :
|-> 0000 (uid)
|-> avatar : 'url'
|-> name : 'josh'
|-> 1111
|-> avatar : 'url'
|-> name : 'steve'
[...]
follow :
|-> 0000
|-> 1111 : true
|-> 8888 : true
[...]
message :
|-> 0000
|-> 8888
|-> 1264978800 (timestamp)
|-> message = "hello"
|-> 1264978987
|-> message = "How are you"
|-> 8888
|-> 0000
|-> 1264914253
|-> message = "hey dude "
|-> 1264975895
|-> message = "fine and you?"
If I want to get the profile and the conversation between 0000 and 8888 (to get they avatar for exemple), I need to:
- check if their friend
- if yes, get messages of 0000
- get messages of 8888
- get 0000 profile
- get 8888 profile
If I want a list of all conversation of 0000, I need to do:
- check all user to know if they're friend
- for each friend, get profile
- for each friend, get list of message.
This is very simple queries and this seem more heavy than in mysql for exemple.
There is a way to don't do all these queries? My database pattern is good?
Thanks for help.