Using Firebase Function, I have created a function that allows users to complete their profile by adding an entry to the Firebase Realtime Database. Here is an example of how the database structure looks:
{
users:
{
AeknQrtMIyPpC4EQDPNQYvQUxCA3:
{
username : test
profilePicture : https://url.com/1
}
AekyPpC4EQnQrtMIQUxCA3yPpC4v:
{
username : test2
profilePicture : https://url.com/2
}
}
}
This function requires userId, username, and profilePicture as parameters.
When the function is called, I would like to be able to check if the desired username already exists in the database.
Although I have reviewed the documentation provided at the following links, I am facing difficulties in implementing it: https://firebase.google.com/docs/database/web/lists-of-data https://firebase.google.com/docs/reference/js/firebase.database.Query
Thank you for your assistance.