I have a firebase firestore with some reference datatype.
I Hope, this is the correct way.
Now when i get my user from firebase, i have this reference object with the id of it. But if i call my function to get the doc, i get an error message:
First my function and how i call it:
export const getClubById = async (id: string) => {
const doc = collection(db, 'clubs', id)
return doc
}
const userData = dbUser.data()
const club = await getClubById(userData.selectedClub.id)
console.log('club', club)
And here the error message:
Uncaught (in promise) FirebaseError: Invalid collection reference. Collection references must have an odd number of segments, but clubs/vA7R94pX3bpHDsYIr6Ge has 2.