Here's everything we announced at I/O, from new Firebase Studio features to more ways to integrate AI.
Read blog.
QueryDocumentSnapshot class
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
QueryDocumentSnapshot
包含作为查询的一部分从 Firestore 数据库的文档读取的数据。该文档一定会存在,并且可以使用 .data()
或 .get(<field>)
提取其数据以获取特定字段。
QueryDocumentSnapshot
提供与 DocumentSnapshot
相同的 API Surface。由于查询结果仅包含现有文档,因此 exists
属性将始终为 true,而 data()
绝不会返回“undefined”。
签名:
export declare class QueryDocumentSnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends DocumentSnapshot<AppModelType, DbModelType>
扩展:DocumentSnapshot<AppModelType, DbModelType>
方法
方法 |
修饰符 |
说明 |
data() |
|
以 Object 的形式检索文档中的所有字段。 |
QueryDocumentSnapshot.data()
以 Object
的形式检索文档中的所有字段。
签名:
/** @override */
data(): AppModelType;
返回:
应用模型类型
包含文档中的所有字段的 Object
。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-09-09。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-09-09。"],[],[]]