So far on my firebase I have something like:
Users
293840ajldkjfas0d9
username: Jill
09283049802930laks
username: Jack
I'm basically going to just have a text field and when someone hits the "add" button, a search through firebase gets done to make sure that username exists, and go from there on connecting the two as friends.
My question is I'm not understanding how I would sort through my data if it's structured like this? I might be totally missing something but is there a way to search through what I have now and say "Go to my users reference, go to through each UID and pull out the username and see if it matches what the user put in the text field, and if so grab the UID connected to the username"?
I'm almost thinking I need to have an entirely separate branch? that I have in addition to what I already have that looks like
Usernames
Jack
09283049802930laks
Jill
lasdjf9j09u90320j09
Which would then allow me to just go to my usernames and go through and check through the values inside that (jack/Jill) and then if it exists then pull that uid out of the username.
1) Do I need both of these branches or is there a way to accomplish what I'm trying to do with just my first?
2) How exactly do I check for that match? Would a query be used or just checking for Null somehow?
3) Is this even the right way to go about doing this? I've found little to no information on friends lists online so this is just all an assumption.
Any help is appreciated!
Aucun commentaire:
Enregistrer un commentaire