简体   繁体   English

更新 Cloud Firestore 中的字段时两个地图之间的区别

[英]Difference between two maps when updating field in cloud firestore

var data = {
  'key.number': 1,
};

var data = {
  'key' : {
    'number': 1,
  }
};

Is there any difference between the two Map s when updating number on the cloud firestore using使用更新云 firestore 上的number时,两个Map之间有什么区别

var ref = Firestore.instance.document('users/id');
ref.updateData(data);

If the document didn't already have a "key" field, there is no difference.如果文档还没有“关键”字段,则没有区别。

If the document did already have a "key" field, the first one would just overwrite any existing value for key.field , preserving any other fields in the key object, and the second one would completely overwrite the key object and all of its existing fields.如果文档确实已经有一个“键”字段,第一个将覆盖key.field的任何现有值,保留键 object 中的任何其他字段,第二个将完全覆盖键 object 及其所有现有值领域。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 2 个日期(时间戳)之间的差异 Android Studio 和 Cloud Firestore - Difference between 2 dates ( timestamps ) Android Studio and Cloud Firestore Cloud Firestore 和 Firebase 实时数据库有什么区别? - What's the difference between Cloud Firestore and the Firebase Realtime Database? 在 Google Cloud Firestore 的子集合中更新依赖于多个文档的字段时,如何避免竞争条件? - How can I avoid a race condition when updating a field that's dependent multiple documents in a subcollection in Google cloud firestore? 更新 Firestore 文档时如何防止 Cloud Function 出现滞后 - How to prevent lag in Cloud Function when updating Firestore document 更新 firestore 中的 map 字段 - Updating a map field in firestore 如果字段存在则更新 Firestore - Updating Firestore if field exists 在 Vue 中使用云 Firestore 更新 boolean 值 - Updating boolean value with cloud firestore in Vue 使用 Flutter 更新图像时,更新 Cloud Firestore 中对图像 url 的所有引用 - Updating all the references to an image url in Cloud Firestore when the image is updated using Flutter 如何增加 Cloud Firestore 中的现有数字字段 - How to increment existing number field in Cloud Firestore Firebase 云功能不更新 Firestore 数据库中的数据 - Firebase Cloud function not updating data in Firestore database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM