如何获取cloudfirestore集合中的第一个文档(颤振/飞镖)

时间:2019-11-11 14:19:21

标签: flutter dart google-cloud-firestore

我在名为('goal')的云Firestore中有此集合,到目前为止,有两个文档'Nov 10,2019'和'Nov 11,2019'。如何获取以编程方式首次创建的文档(2019年11月10日)?

这是我的消防站的样子: enter image description here

1 个答案:

答案 0 :(得分:0)

由于@Doug Stevenson,我设法得出了答案!

var document2 = await Firestore.instance
        .collection('users')
        .document(userData[index].uID) // I store my user's UID locally in a FutueBuilder func hence the index
        .collection('goal')
        .orderBy("dateAdded")
        .limit(1)
        .getDocuments()
        .then((QuerySnapshot a) {});