本文介绍了Firestore-如何从Android更新其密钥中包含period(.)的字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新包含句点(.)的字段无法正常工作.在文档中,可以通过提供点分隔的归档路径字符串或提供FieldPath对象来更新嵌套字段.因此,如果我有一个字段,关键是"com.example.android"如何更新该字段(从Android)?

Updating a field contains period (.) is not working as expected.In docs, nested fields can be updated by providing dot-seperated filed path strings or by providing FieldPath objects.So if I have a field and it's key is "com.example.android" how I can update this field (from Android)?

在我的情况下,如果文件不存在,则必须设置该文件,否则请更新该文件.因此,首先要创建的字段包含上述类似的句点,然后尝试更新同一字段,因为它包含句点,因此正在使用嵌套字段创建新字段.

In my scenario I've to set the document if it's not exists otherwise update the document. So first set is creating filed contains periods like above and then trying update same field it's creating new field with nested fields because it contains periods.

db.collection(id).document(uid).update(pkg, score)

推荐答案

现在已修复.不是那样的事情.

It's fixed now. It's not happening like that.

这篇关于Firestore-如何从Android更新其密钥中包含period(.)的字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 03:39