How to run a query in Firestore to bring more than one document

0

I'm developing an ionic application, and I need to fetch all the data from a document called Patient, and I also need to bring the ID of the doctor that is in another document, and also bring the specialty ID of the doctor who is in a third document called specialty. I'm trying to use the where, but I do not know how to do it, that's how I tried.

loadData(){
    var query = firebase.firestore().collection("Usuario")
    var auxint = 0;
    this.dataAux
    let auxString = '[';
    //db.collection('Usuario').where("Documento.id", "==", '1').get().then(res => {
    query.where("Deletado", "==", true).get().then(res => {
      res.forEach(item => {

        auxint++;
        auxString += '{"id":"' + item.id + '","Usuario":' + JSON.stringify(item.data()) + '}';

        if (res.size != auxint)
          auxString += ', ';
      })
      auxString += ']';
      this.dataJSON = JSON.parse(auxString);

      console.log(this.dataJSON);
    }).catch(err => {
      console.log('algum erro ' + err);
    });
}

.html

 <ion-item-sliding *ngFor="let data of dataJSON">
      <ion-item>
        <h3>DataCriacao: {{data.Usuario.DataCriacao}}</h3>
        <p>DataUpdate: {{data.Usuario.DataUpdate}}</p>
        <p>DELETADO: {{data.Usuario.Deletado}}</p>
        <p>EMAIL: {{data.Usuario.Documento.email}}</p>
        <p>ID: {{data.id}}</p>
        <p>NOME: {{data.Usuario.Documento.nome}}</p>
        <p>SENHA: {{data.Usuario.Documento.senha}}</p>
        <p>TELEFONE: {{data.Usuario.Documento.telefone}}</p>
      </ion-item>
      <ion-item-options>
    
asked by anonymous 17.09.2018 / 17:37

0 answers