Problem with update ionic + firestore


#1

I get the error of the image when trying to do an update in the database. The case is as follows, the user views an ad, and receives a value of 0.03 cents (this is symbolic). So the first time he gets the 0.03 he clicks to save data to write to the bank, so that’s fine. Then if the value is greater than 0.03 it will update its value, then see another ads receive + 0.03 and save again, updating the value. For this I created two functions, one that adds and one that updates the value, when I try to update it shows the error of the image, I can not find out where I went wrong.

//adds the value to the database
    adicionarRecompensa() {
      this.recompensa.recompensaSalva = true;
      this.recompensa.valor = this.recompensaAcumulada;
      this.providerRecompensa.adicionarRecompensa(this.recompensa);
        this.toastAddRecompensa();
    }


    //update the value in the database
    atualizarRecompensa(recompensa: Recompensa) {
       this.providerRecompensa.atualizarRecompensa(this.recompensa.id, 
       this.recompensa);
         this.toastAtualizarRecompensa();
    }


    //writes the value to the database
    salvarRecompensa() {
       //if the value is equal 0.03
       if(this.recompensa.valor == 0.03 || NaN){
          this.adicionarRecompensa();
       }

       //if the value is greater than 0.03 it does update every time the user click save reward
       if(this.recompensa.valor > 0.03){
         this.atualizarRecompensa(this.recompensa);
       }

    }




   //PROVIDER 
   import { Injectable } from '@angular/core';
   import { AngularFirestore, AngularFirestoreCollection } from 
           'angularfire2/firestore';
   import { Observable } from 'rxjs/Observable';
   import { LoginProvider } from '../../providers/login/login';
   import { Recompensa } from '../../models/recompensa';

   @Injectable()

       export class RecompensaProvider {

       recompensaSalva = true;
       private caminho: string = '';
       private recompensaColllection: 
       AngularFirestoreCollection<Recompensa>;
       recompensas: Observable<Recompensa[]>;

       constructor(private afs: AngularFirestore, private login: 
                   LoginProvider) {

          this.login.usuario.subscribe(auth => {
             if(auth != null)
            {
               this.caminho = '/' + auth.email ;
               this.recompensaColllection = afs.collection<Recompensa> 
                   (this.caminho, ref => {
              return ref;
            });
            } else {
               this.caminho = '';
           }
        });
      }


    // Method used to add a reward
   adicionarRecompensa(recompensa: Recompensa) {
     this.recompensaColllection.add(recompensa);
   }


   // Method used to update reward
   atualizarRecompensa(id: string, recompensa:Recompensa) {
     this.recompensaColllection.doc(id).update(recompensa);
   }


   // This method will return a list of rewards
   buscarRecompensa(recompensaSalva: boolean) {
      return this.afs
      .collection<Recompensa>(this.caminho, ref => {
      return ref.where('recompensaSalva', '==', recompensaSalva);
      })
        .snapshotChanges()
        .map(actions => {
        return actions.map(a => {
        const data = a.payload.doc.data() as Recompensa;
        const id = a.payload.doc.id;
        return { id, ...data };
      })
    });
   }


}