REST Resource: projects.databases.collectionGroups.fields

资源:字段

表示数据库中的单个字段。

字段按其“集合组”进行分组,集合组表示数据库中具有相同 ID 的所有集合。

JSON 表示法
{
  "name": string,
  "indexConfig": {
    object (IndexConfig)
  }
}
字段
name

string

格式为 projects/{projectId}/databases/{databaseId}/collectionGroups/{collectionId}/fields/{fieldPath} 的字段名称

字段路径可以是简单的字段名称(如 address),也可以是指向 mapValue 中字段的路径(如 address.city)或特殊字段路径。唯一有效的特殊字段是 *,它表示任何字段。

可以使用 (backtick). The only character that needs to be escaped within a quoted field path is the backtick character itself, escaped using a backslash. Special characters in field paths that must be quoted include:*,., ``` (backtick),[,]` 以及任何 ASCII 符号字符引用字段路径。

示例:(注意:此处的注释采用 Markdown 语法编写,因此还有一层额外的反引号来表示代码块)\address.city`represents a field namedaddress.city, not the map key cityin the fieldaddress. `*`represents a field named*`,而不是任何字段。

特殊的 Field 包含所有字段的默认索引编制设置。此字段的资源名称为:projects/{projectId}/databases/{databaseId}/collectionGroups/__default__/fields/*。在此 Field 中定义的索引将应用于自身没有 Field 索引配置的所有字段。

indexConfig

object (IndexConfig)

此字段的索引配置。如果未设置,字段索引编制将还原为 ancestorField 定义的配置。如需明确移除此字段的所有索引,请使用空索引列表指定索引配置。

IndexConfig

此字段的索引配置。

JSON 表示法
{
  "indexes": [
    {
      object (Index)
    }
  ],
  "usesAncestorConfig": boolean,
  "ancestorField": string,
  "reverting": boolean
}
字段
indexes[]

object (Index)

此字段支持的索引。

usesAncestorConfig

boolean

仅供输出。如果为 true,则 Field 的索引配置根据 ancestorField 指定的配置设置。如果为 false,系统会明确定义 Field 的索引配置。

ancestorField

string

仅供输出。指定 Field 的资源名称,系统将根据此资源名称设置此字段的索引配置(当 usesAncestorConfig 为 true 时),或根据此资源设置此字段(如果此字段没有索引配置,则基于此资源名称(当 usesAncestorConfig 为 false 时)。

reverting

boolean

仅在输出结果为 true 时,正在还原 Field 的索引配置。完成后,索引配置将转换为与 ancestorField 指定的字段相同的状态,此时 usesAncestorConfig 将变为 truereverting 将变为 false

方法

get

获取字段的元数据和配置。

list

列出此数据库的字段配置和元数据。

patch

更新字段配置。