I have a collection “user” and the document id of the user is different from current user’s UID. So when I use FirebaseAuth.instance.currentUser!.uid in the following code it doesn’t work. I am using anonymous login to create users not sure if this makes a difference.
FirebaseFirestore.instance.collection('user').doc(FirebaseAuth.instance.currentUser!.uid).collection('subcollection')
Document ID
UID
Would really appreciate it, if someone can clarify:
- If this is normal Firebase behavior to make docid and uid different.
- How to access current user’s data in this scenario.
- How to make both the document id and uid same.