【问题标题】:Calling get() on DocumentSnapshot in Firestore在 Firestore 中的 DocumentSnapshot 上调用 get()
【发布时间】:2020-04-12 23:01:40
【问题描述】:

我是 Firestore 的新手,我有一些类似这样的代码:

let documentSnapshot = Firestore.firestore()
    .collection("my-collection")
    .document("my-doc")
    .getDocument()...

如果我理解正确,我会收到一个 DocumentSnapshot,当我获得整个文档时,这算作 1 次阅读。因此,如果我要这样做,例如:

documentSnapshot.get("Title")

这是否也算作另一次阅读?谢谢!

【问题讨论】:

    标签: swift firebase google-cloud-firestore


    【解决方案1】:

    DocumentSnapshot 对象包含内存中文档的整个内容。这意味着你可以用它做任何你想做的事情,并且不会产生更多的账单。访问各个字段都在内存中完成。

    【讨论】:

    • 感谢您的帮助!
    猜你喜欢
    • 2021-04-27
    • 1970-01-01
    • 2021-07-03
    • 1970-01-01
    • 2019-01-25
    • 2019-11-05
    • 1970-01-01
    • 2019-03-10
    • 2021-04-07
    相关资源
    最近更新 更多