如何仅使用 Cloud Functions 创建 Datastore 复合索引?
How to create Datastore Composite Indexes with just Cloud Functions?
我正在尝试仅使用 Cloud Functions 与 Datastore 交互是否可行。
有没有一种方法可以仅使用 Cloud Functions 创建复合索引(如 index.yaml)?所以只有 Cloud Functions 代码,没有 App Engine 代码。
谢谢!
您只能通过命令行工具 (gcloud datastore create-indexes
) 创建 复合索引定义。这是一项管理功能,不应成为您应用程序的常规部分。您可以使用 Cloud Console 中的浏览器内 'Cloud Shell' 一次性执行此步骤。
它们创建后,由您的 Cloud Functions 代码编写的任何 Cloud Datastore 实体都将添加到复合索引中。
我正在尝试仅使用 Cloud Functions 与 Datastore 交互是否可行。
有没有一种方法可以仅使用 Cloud Functions 创建复合索引(如 index.yaml)?所以只有 Cloud Functions 代码,没有 App Engine 代码。
谢谢!
您只能通过命令行工具 (gcloud datastore create-indexes
) 创建 复合索引定义。这是一项管理功能,不应成为您应用程序的常规部分。您可以使用 Cloud Console 中的浏览器内 'Cloud Shell' 一次性执行此步骤。
它们创建后,由您的 Cloud Functions 代码编写的任何 Cloud Datastore 实体都将添加到复合索引中。