根据ID获取任意用户的Datas

Get the Datas of any user according to ID

所以,这里我如何根据 uids 获取任何用户的数据?

从你的截图我们可以看到字段uid的值也被用作用户的Firestore文档的ID(这是一个很好的方法:-))

因此,您可以简单地查询特定用户的文档,如下所示:

let docRef = db.collection("users").document(uid)  // We use the uid to define the Document Reference 

docRef.getDocument { (document, error) in
    if let document = document, document.exists {
        let dataDescription = document.data().map(String.init(describing:)) ?? "nil"
        print("Document data: \(dataDescription)")
    } else {
        print("Document does not exist")
    }
}