Firestore - batch.add is not a function

前端 未结 6 1139
滥情空心
滥情空心 2020-12-24 10:31

The documentation for Firestore batch writes lists only set(), update() and delete() as permitted operations.

Is there no way

6条回答
  •  别那么骄傲
    2020-12-24 11:17

    In my case, using AngularFire2, I had to use the batch.set() method, passing as first parameter the document reference with an ID previously created, and the reference attribute:

    import { AngularFirestore } from '@angular/fire/firestore';
    ...
    private afs: AngularFirestore
    ...
    batch.set(
        this.afs.collection('estados').doc(this.afs.createId()).ref,
        er.getData()
      );
    

提交回复
热议问题