[英]Trying to delete a multi-path firestore field document with the batch method
I'm trying to delete a field document with multi-path location with the firestore batch method. 我正在尝试使用firestore批处理方法删除具有多路径位置的现场文档。 I used to do it with the update method on Real Time Database.
我曾经使用实时数据库上的更新方法来做到这一点。 Now I don't really know how to do it on Firestore.
现在,我真的不知道如何在Firestore上进行操作。
deleteVenueFromEvent(event)
{
var eventkey = event.$key;
var venuekey = event.venue.venuekey;
var batch = this.afs.firestore.batch();
var eventRef = this.eventCollection.doc(eventkey).ref;
batch.update(eventRef, { venue: null });
var deleteVenueRef = this.venueCollection.doc(venuekey).collection('events').doc(eventkey).ref;
batch.delete(deleteVenueRef);
batch.commit().then(function() {console.log('Batch Delete')});
}
I find the way to do it with the following code : 我找到了使用以下代码的方法:
var deleteVenueRef = this.venueCollection.doc(venuekey).ref;
batch.update(deleteVenueRef, {['events.' + eventkey] :firebase.firestore.FieldValue.delete()});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.