Firebase 无法将事务集与SetOptions合并
我必须使用事务来设置和更新Firestore中的某些数据。如果旧数据已经存在,我想合并新数据。这在没有交易的情况下是可能的,但有了它们,我似乎无法做到,即使它说你可以做到 从Flatter Firestore实现中,我可以看到以下文档:Firebase 无法将事务集与SetOptions合并,firebase,flutter,dart,google-cloud-firestore,Firebase,Flutter,Dart,Google Cloud Firestore,我必须使用事务来设置和更新Firestore中的某些数据。如果旧数据已经存在,我想合并新数据。这在没有交易的情况下是可能的,但有了它们,我似乎无法做到,即使它说你可以做到 从Flatter Firestore实现中,我可以看到以下文档: /// Writes to the document referred to by the provided [DocumentReference]. /// If the document does not exist yet, it will be crea
/// Writes to the document referred to by the provided [DocumentReference].
/// If the document does not exist yet, it will be created. If you pass
/// SetOptions, the provided data can be merged into the existing document.
Future<void> set(
///.....
在Firestore的Flatter版本中有可能做到这一点吗?或者这是一个错误,尚未实现?查看,似乎没有一个transaction.set()的变体,它接受类似于
SetOptions的内容。您可能想了解这一点。我发布了一个问题,但团队似乎没有注意到。
transaction.set(doc.reference, {
"liked": FieldValue.arrayUnion([entryInfo.id]),
});