【问题标题】:How do i update my firebase v8 code to v9 in React-native?如何在 React-native 中将我的 firebase v8 代码更新为 v9?
【发布时间】:2022-08-12 23:30:25
【问题描述】:

所以我想将我的文档设置在 firebase 上,以便提交的电子邮件成为文档 ID 使用 Firebase 的 v8,我可以做到

db.collectiion(\'dbName\')
.doc({authorizedUserEmail})
.set({
\'myProperty: dataType\'
})

但是对于 v9,即使在使用文档时我也无法弄清楚 https://firebase.google.com/docs/firestore/query-data/get-data

我也在写 React-native

    标签: firebase react-native


    【解决方案1】:

    doc 中所述,您可以执行以下操作:

    import { doc, setDoc } from "firebase/firestore"; 
    
    await setDoc(doc(db, "dbName", {authorizedUserEmail}), {
      'myProperty: dataType'
    });
    

    请注意,“collection”只需要一个“i”(您的代码包含db.collectiion('dbName'))。

    【讨论】:

    • 谢谢,该集合在创建问题时出现拼写错误。
    猜你喜欢
    • 2021-11-10
    • 1970-01-01
    • 2021-12-12
    • 2018-06-09
    • 2018-11-06
    • 2021-06-14
    • 2018-01-16
    • 2019-04-13
    • 2020-04-07
    相关资源
    最近更新 更多