简体   繁体   English

firebase 文档 当文档中存在 map 和数组时,某些字段显示为 null

[英]firebase document some fields are showing as null when map and array exist in the document

I am having document with array and map fields.我有包含数组和 map 字段的文档。 When i try to get this in data class some other fields are getting null.当我尝试在数据 class 中获取此数据时,其他一些字段正在获取 null。

for example - orderQty is getting as null.例如 - orderQty 为 null。

火力点订单文件

数据类

At first glance, I can see that the names of the fields in your Orders class are different than the names that exist in the database.乍一看,我可以看到您的Orders class 中的字段名称与数据库中存在的名称不同。 In your class, the fields start with an upper-case letter, while in the database start with a lower-case letter.在您的 class 中,字段以大写字母开头,而在数据库中以小写字母开头。 And this is not correct, the names must match.这是不正确的,名称必须匹配。 The simplest solution would be to change the names of the fields in the class. So a field called OrderNo should be changed to orderNo .最简单的解决方案是更改 class 中字段的名称。因此应将名为OrderNo的字段更改为orderNo See the lower-case o ?看到小写的o了吗?

Alternatively, you can use an annotation like this:或者,您可以使用这样的注释:

@get:PropertyName("orderNo")
@set:PropertyName("orderNo")
var OrderNo: String? = null,

暂无
暂无

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

相关问题 获取 Firebase 文档快照到 Map - Get Firebase Document Snapshot to a Map Firebase:将文档 ID 存储在文档本身中,同时作为 Map 推送 - Firebase: Storing a document ID within document itself while pushing as a Map 为什么我的 Firebase Cloud Firestore 数据文档随机显示? - Why my Firebase Cloud Firestore data document randomly showing? Firebase 安全规则 Map 方法 get() 是否算作文档读取? - Does Firebase security rules Map method get() count as a document read? DynamoDB Map/Document扫描时为空,但在表中不为空 - DynamoDB Map/Document is empty when scanned, but is not empty in the table React & Firebase,useState 不更新,并传入空数组到文档中的数组 - React & Firebase, useState not updating, and passing in empty array, to array in document 获取自动生成的文档 ID 以创建文档或更新文档 Firestore / Firebase 中的数组的更好方法 - Better way to get document ID which was auto generated to create the doc or update an array inside the document Firestore / Firebase 是否可以更新 firebase 集合文档中另一个数组中数组项的值 - Is it possible to update the value of an array item inside another array in a firebase collection document 检查集合中是否存在文档失败 - check if Document exist in a collection failed 当用户使用 Firebase Stripe 订阅时,在用户文档上放置一个字段 - Place a field on the user document when the user subscribes using Firebase Stripe
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM