I am currently attempting to retrieve a document reference from Firestore using the code below:
var sfDocRef = database.collection("tags").doc("567BHJV6JF95HVCF44HB");
When I hover over sfDocRef
, it displays:
(local var) sfDocRef: FirebaseFirestore.DocumentReference<FirebaseFirestore.DocumentData>
However, my goal is to obtain the address of the document based on its name instead of its ID. To achieve this, I am utilizing the following code:
var sfDocRef = database.collection("tags").where("userName", "==", userName);
Upon hovering over this code, the displayed datatype is as follows:
(local var) sfDocRef: FirebaseFirestore.Query<FirebaseFirestore.DocumentData>
I am in need of the DocumentReference
datatype using the username instead of the ID. Is there a way to accomplish this in a single line? I have not found any relevant information in the documentation. Any assistance would be greatly appreciated.