当云函数建议在第二代上运行时,现在有新的 FirestoreAdminClient 可以使用吗?

问题描述 投票:0回答:1

将数据从 Firestore 导出到存储桶时,我遵循建议的解决方案:安排数据导出

解决方案中精选的一些代码如下:

const client = new firestore.v1.FirestoreAdminClient();
...
const projectId = process.env.GCP_PROJECT;
const databaseName = client.databasePath(projectId, '(default)');

return client.exportDocuments({
    name: databaseName,
    outputUriPrefix: bucket,
    collectionIds: []
    })
...

现在,有了第二代,我知道例如相反,可以使用预定义的参数从

firebase-functions/params

获取项目 ID

但是有一个新的

FirestoreAdminClient
应该/可以用来做
databasePath()
exportDocuments()
吗?

node.js firebase google-cloud-firestore google-cloud-functions
1个回答
0
投票

不。您看到的 FirestoreAdminClient 版本(来自节点模块“@google-cloud/firestore”)与 Firebase CLI 支持的 Cloud Functions 版本(来自节点模块“firebase-functions”)无关。除了您选择如何在同一项目中使用它们之外,它们几乎彼此完全无关。

来自

@google-cloud/firestoreFirebaseAdminClient 在 GCP 上有自己的文档,您可以按照其自己的条款阅读和理解该文档,并在运行 Nodejs(包括 Cloud Functions)的任何地方使用该文档。

© www.soinside.com 2019 - 2024. All rights reserved.