Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nurfarazi/2a880f1c69211f296d525d98c862ee94 to your computer and use it in GitHub Desktop.
Save nurfarazi/2a880f1c69211f296d525d98c862ee94 to your computer and use it in GitHub Desktop.
resetScore(): Promise<void> {
return this.usersCollectionRef.ref.get().then(resp => {
console.log(resp.docs)
let batch = this.afs.firestore.batch();
resp.docs.forEach(userDocRef => {
batch.update(userDocRef.ref, {'score': 0, 'leadsWithSalesWin': 0, 'leadsReported': 0});
})
batch.commit().catch(err => console.error(err));
}).catch(error => console.error(error))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment