firebase-firestore

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Cloud Firestore Database and Operations

Cloud Firestore数据库及操作

Before setting up dependencies, writing data models, or configuring security rules, you MUST always identify the Firestore instance edition.
在设置依赖项、编写数据模型或配置安全规则之前,您必须先确定Firestore实例的版本。

1. Instance Selection and Edition Detection

1. 实例选择与版本检测

Run the following command to list current Firestore databases:
bash npx -y firebase-tools@latest firestore:databases:list
运行以下命令列出当前的Firestore数据库:
bash npx -y firebase-tools@latest firestore:databases:list

A. Instance Found

A. 已找到实例

  1. For each database found, inspect its edition and details:
    bash npx -y firebase-tools@latest firestore:databases:get <database-id>
  2. Ask the user which database instance they wish to target or if they would prefer to create a new instance.
  3. Once the target instance is established:
    • If the
      edition
      is
      STANDARD
      , follow the guides under
      references/standard/
      .
    • If the
      edition
      is
      ENTERPRISE
      or native mode, follow the guides under
      references/enterprise/
      .
  1. 对于每个找到的数据库,查看其版本和详细信息:
    bash npx -y firebase-tools@latest firestore:databases:get <database-id>
  2. 询问用户希望以哪个数据库实例为目标,或者是否想要创建一个新实例。
  3. 确定目标实例后:
    • 如果**
      edition
      **为
      STANDARD
      ,请遵循
      references/standard/
      下的指南。
    • 如果**
      edition
      **为
      ENTERPRISE
      或原生模式,请遵循
      references/enterprise/
      下的指南。

B. No Instance Found (or New Requested)

B. 未找到实例(或用户要求创建新实例)

If no databases exist or the user requests a new one, default to provisioning an Enterprise edition database and ask the user what location to use. Run
npx -y firebase-tools@latest firestore:locations
to get the list of options. Suggest colocating with other resources if applicable.
Once the location is determined, create the database:
bash npx -y firebase-tools@latest firestore:databases:create <database-id> --edition="enterprise" --location="<selected-location>"
Proceed with using the guides under
references/enterprise/
.

如果不存在任何数据库,或者用户要求创建新数据库,默认配置企业版数据库,并询问用户要使用的位置。运行
npx -y firebase-tools@latest firestore:locations
获取可选位置列表。如果适用,建议与其他资源同区域部署。
确定位置后,创建数据库:
bash npx -y firebase-tools@latest firestore:databases:create <database-id> --edition="enterprise" --location="<selected-location>"
继续使用
references/enterprise/
下的指南。

2. Specialized Guides

2. 专项指南

Based on the identified or created instance edition, open and read the corresponding reference guides:
根据已确定或创建的实例版本,打开并阅读对应的参考指南:

Standard Edition (
references/standard/
)

标准版(
references/standard/

  • Provisioning: Read provisioning.md
  • Security Rules: Read security_rules.md
  • SDK Usage: Read web_sdk_usage.md, android_sdk_usage.md, ios_setup.md, or flutter_setup.md
  • Indexes: Read indexes.md
  • 配置部署:阅读provisioning.md
  • 安全规则:阅读security_rules.md
  • SDK使用:阅读web_sdk_usage.mdandroid_sdk_usage.mdios_setup.mdflutter_setup.md
  • 索引:阅读indexes.md

Enterprise Edition / Native Mode (
references/enterprise/
)

企业版/原生模式(
references/enterprise/

  • Provisioning: Read provisioning.md
  • Data Model: Read data_model.md
  • Security Rules: Read security_rules.md
  • SDK Usage:
    [!CRITICAL] Mandatory Reference Reading Before writing or modifying any application code for Firestore Enterprise Edition, you MUST read at least one of the relevant reference documents below for the target platform/language to understand specific architectural requirements and pipeline initialization patterns.
    Read web_sdk_usage.md, python_sdk_usage.md, android_sdk_usage.md, ios_setup.md, or flutter_setup.md
  • Indexes: Read indexes.md
  • 配置部署:阅读provisioning.md
  • 数据模型:阅读data_model.md
  • 安全规则:阅读security_rules.md
  • SDK使用
    [!CRITICAL] 必读参考文档 在为Firestore企业版编写或修改任何应用代码之前,您必须阅读以下针对目标平台/语言的相关参考文档中的至少一篇,以了解特定的架构要求和管道初始化模式。
    阅读web_sdk_usage.mdpython_sdk_usage.mdandroid_sdk_usage.mdios_setup.mdflutter_setup.md
  • 索引:阅读indexes.md