【发布时间】:2019-01-23 14:42:09
【问题描述】:
如何从云存储功能中删除文档中的字段?
我正在使用事务,所以我尝试了这种方法:
const { FieldValue } = require('@google-cloud/firestore');
...
..
transaction.update(docRef, { fieldToRemove: FieldValue.delete() });
但我收到此错误:
Transaction failure: Error: Update() requires either a single JavaScript object or an alternating list of field/value pairs that can be followed by an optional precondition. Argument "dataOrField" is not a valid Document. Couldn't serialize object of type "DeleteTransform". Firestore doesn't support JavaScript objects with custom prototypes (i.e. objects that were created via the 'new' operator).
谢谢!
【问题讨论】:
标签: firebase google-cloud-firestore google-cloud-functions