fields
Creates, updates, deletes, gets or lists a fields
resource.
Overview
Name | fields |
Type | Resource |
Id | google.firestore.fields |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Required. A field name of the form: projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path} A field path can be a simple field name, e.g. address or a path to fields within map_value , e.g. address.city , or a special field path. The only valid special field is * , which represents any field. Field paths can be quoted using ` (backtick). The only character that must 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), [ , ] , as well as any ascii symbolic characters. Examples: `address.city` represents a field named address.city , not the map key city in the field address . `*` represents a field named * , not any field. A special Field contains the default indexing settings for all fields. This field's resource name is: projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/* Indexes defined on this Field will be applied to all fields which do not have their own Field index configuration. |
indexConfig | object | The index configuration for this field. If unset, field indexing will revert to the configuration defined by the ancestor_field . To explicitly remove all indexes for this field, specify an index config with an empty list of indexes. (id: GoogleFirestoreAdminV1IndexConfig) |
ttlConfig | object | The TTL configuration for this Field . Setting or unsetting this will enable or disable the TTL for documents that have this Field . (id: GoogleFirestoreAdminV1TtlConfig) |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Required. A field name of the form: projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path} A field path can be a simple field name, e.g. address or a path to fields within map_value , e.g. address.city , or a special field path. The only valid special field is * , which represents any field. Field paths can be quoted using ` (backtick). The only character that must 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), [ , ] , as well as any ascii symbolic characters. Examples: `address.city` represents a field named address.city , not the map key city in the field address . `*` represents a field named * , not any field. A special Field contains the default indexing settings for all fields. This field's resource name is: projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/* Indexes defined on this Field will be applied to all fields which do not have their own Field index configuration. |
indexConfig | object | The index configuration for this field. If unset, field indexing will revert to the configuration defined by the ancestor_field . To explicitly remove all indexes for this field, specify an index config with an empty list of indexes. (id: GoogleFirestoreAdminV1IndexConfig) |
ttlConfig | object | The TTL configuration for this Field . Setting or unsetting this will enable or disable the TTL for documents that have this Field . (id: GoogleFirestoreAdminV1TtlConfig) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , databasesId , collectionGroupsId , fieldsId | Gets the metadata and configuration for a Field. | |
list | select | projectsId , databasesId , collectionGroupsId | filter , pageSize , pageToken | Lists the field configuration and metadata for this database. Currently, FirestoreAdmin.ListFields only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with the filter set to indexConfig.usesAncestorConfig:false or ttlConfig:* . |
patch | update | projectsId , databasesId , collectionGroupsId , fieldsId | updateMask | Updates a field configuration. Currently, field updates apply only to single field index configuration. However, calls to FirestoreAdmin.UpdateField should provide a field mask to avoid changing any configuration that the caller isn't aware of. The field mask should be specified as: { paths: "index_config" } . This call returns a google.longrunning.Operation which may be used to track the status of the field update. The metadata for the operation will be the type FieldOperationMetadata. To configure the default field settings for the database, use the special Field with resource name: projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/* . |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
collectionGroupsId | string | |
databasesId | string | |
fieldsId | string | |
projectsId | string | |
filter | string | |
pageSize | integer (int32) | |
pageToken | string | |
updateMask | string (google-fieldmask) |
SELECT
examples
- get
- list
Gets the metadata and configuration for a Field.
SELECT
name,
indexConfig,
ttlConfig
FROM google.firestore.fields
WHERE projectsId = '{{ projectsId }}' -- required
AND databasesId = '{{ databasesId }}' -- required
AND collectionGroupsId = '{{ collectionGroupsId }}' -- required
AND fieldsId = '{{ fieldsId }}' -- required;
Lists the field configuration and metadata for this database. Currently, FirestoreAdmin.ListFields only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with the filter set to indexConfig.usesAncestorConfig:false
or ttlConfig:*
.
SELECT
name,
indexConfig,
ttlConfig
FROM google.firestore.fields
WHERE projectsId = '{{ projectsId }}' -- required
AND databasesId = '{{ databasesId }}' -- required
AND collectionGroupsId = '{{ collectionGroupsId }}' -- required
AND filter = '{{ filter }}'
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
UPDATE
examples
- patch
Updates a field configuration. Currently, field updates apply only to single field index configuration. However, calls to FirestoreAdmin.UpdateField should provide a field mask to avoid changing any configuration that the caller isn't aware of. The field mask should be specified as: { paths: "index_config" }
. This call returns a google.longrunning.Operation which may be used to track the status of the field update. The metadata for the operation will be the type FieldOperationMetadata. To configure the default field settings for the database, use the special Field
with resource name: projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*
.
UPDATE google.firestore.fields
SET
data__name = '{{ name }}',
data__indexConfig = '{{ indexConfig }}',
data__ttlConfig = '{{ ttlConfig }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND databasesId = '{{ databasesId }}' --required
AND collectionGroupsId = '{{ collectionGroupsId }}' --required
AND fieldsId = '{{ fieldsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
done,
error,
metadata,
response;