In Firestore, I have a uid
as a field in my Vendor
documents:
/vendors
+doc1
uid: 1
+doc2
uid: 2
To access the vendors, I'm using the following function:
getVendor(index: string): AngularFirestoreDocument<Vendor> {
return afs.doc<Vendor>(`vendors/${index}`);
}
I'd like to create a similar function, which also returns an AngularFirestoreDocument
, but the function takes a uid
to get the document:
getVendorByUID(uid: string): AngularFirestoreDocument<Vendor> {
...
return theDoc;
}
It seems like I have to query an AngularFirestoreCollection, but don't know how to extract the Document from the Collection.