I am building a React app with a Firebase back end and Firebase Cloud Functions. I have a collection called 'users' and in it users are stored with their uid and data which include Name and phone number. Each user has a unique phone number. The user data looks like this:
{
uid: i8uCaO5yDYT5aICpFgxPJYRLzor1,
data: {
first_name: 'Name',
last_name: 'Alsoname',
id_number: '123242133'
}
}
I would like to get back a user data object if the ID number matches the parameter I pass. I try doing it like this:
const userObject = admin.firestore().collection('users')
.where('id_number', '==', '123242133').get();
I am stuck on how to get the uid of this user and the other data that is inside of it. Please help. Thanks.