Firebase - Admin.firestore 对比 functions.firestore

Firebase - Admin.firestore vs functions.firestore

我是云函数的新手。我有一些困惑。

  1. admin.firestore和admin.firestore有区别吗 functions.firestore?
  2. admin.database是实时数据库吗?
  3. 所以如果云函数基本写成JavaScript或者 Node.js 环境中的 TypeScript,然后我可以用 JavaScript。但是文档让我对此感到困惑。因为 每当我阅读文档时,它都会给出不同的东西。为了 例如,

上面获取文档的代码,它使用document('some/doc') 但是,上面的代码使用 doc('doc') 来实现相同的功能。如果它们都来自 firestore,为什么两者彼此不同?

有人可以帮助我理解这些问题吗?感谢大家的支持。

functions.firestore:用来设置一个trigger. You can set up a listener on a document path so that whenever an event happens on that document (create/update/delete etc.), this function will be executed. See how to create one here.

admin.firestore:用于创建对 firestore 数据库的引用。您可以通过该参考使用 admin sdk 在 firestore collection/documents 上执行各种操作。参见 documentation