Firestore中有一个Map。我有另一个名为correctAnswersNew的Map,我希望将其添加到现有的MapcorrectAnswers中。类似于以下内容:
correctAnswersNew
correctAnswers
await mycollection .doc("1") .update('correctAnswers' : correctAnswersNew).then( (value) => null);
await mycollection
.doc("1")
.update('correctAnswers' : correctAnswersNew).then(
(value) => null);
字符串对于数组,使用FieldValue.arrayUnion很容易,但是对于map也有选择吗?
FieldValue.arrayUnion
kq0g1dla1#
是的,您可以像这样向现有的map值添加新值:
await mycollection .doc("1") .update({ 'correctAnswers.correctAnswersNew': correctAnswersNew,});
.update({
'correctAnswers.correctAnswersNew': correctAnswersNew,
});
字符串
1条答案
按热度按时间kq0g1dla1#
是的,您可以像这样向现有的map值添加新值:
字符串