How to get value of some field in firebase firestore android?

前端 未结 3 1837
深忆病人
深忆病人 2020-12-05 16:24

Like upper question, i want to get value of some field in firebase firestore instead of all document with DocumentSnapshot

like this in SQL SE

3条回答
  •  遥遥无期
    2020-12-05 16:50

    try this code:

    //set a global variable
    dataList: Array;
    
    
    const dataCollection = firebase.firestore().collection('data');
    dataCollection.get(query => {
    query.forEach(docs => {
    this.dataList.push({id: doc.id, data:doc.data()});
      })
    })
    

提交回复
热议问题