change_streams
Creates, updates, deletes, gets or lists a change_streams resource.
Overview
| Name | change_streams |
| Type | Resource |
| Id | google.firestore.change_streams |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
name | string | Identifier. The external resource name of the change stream. Format projects/{project}/databases/{database}/changeStreams/{change_stream} |
collectionGroupScope | object | If set, the change stream is scoped to a collection group. (id: GoogleFirestoreAdminV1CollectionGroupScope) |
createTime | string (google-datetime) | Output only. The time the Change Stream was created. |
databaseScope | object | If set, the change stream is scoped to the entire database. (id: GoogleFirestoreAdminV1DatabaseScope) |
etag | string | Optional. An etag used to determine which version of the configuration is being edited. |
retentionPeriod | string (google-duration) | Required. The retention period of the change stream. This is the amount of time a change event is available on the change stream. Must be from 1 to 7 days, inclusive. The retention_period must be in day granularity, i.e. it must be a multiple of 24 hours. |
startTime | string (google-datetime) | Output only. The time the Change Stream started recording events. |
updateTime | string (google-datetime) | Output only. The time the Change Stream was last updated. |
| Name | Datatype | Description |
|---|---|---|
changeStreams | array | The list of change streams. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | projectsId, databasesId, changeStreamsId | Gets information about a change stream. | |
list | select | projectsId, databasesId | Lists all change streams in a database. | |
create | insert | projectsId, databasesId | changeStreamId | Creates a new change stream for the database. |
delete | delete | projectsId, databasesId, changeStreamsId | etag | Deletes a change stream. |
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 |
|---|---|---|
changeStreamsId | string | |
databasesId | string | |
projectsId | string | |
changeStreamId | string | |
etag | string |
SELECT examples
- get
- list
Gets information about a change stream.
SELECT
name,
collectionGroupScope,
createTime,
databaseScope,
etag,
retentionPeriod,
startTime,
updateTime
FROM google.firestore.change_streams
WHERE projectsId = '{{ projectsId }}' -- required
AND databasesId = '{{ databasesId }}' -- required
AND changeStreamsId = '{{ changeStreamsId }}' -- required
;
Lists all change streams in a database.
SELECT
changeStreams
FROM google.firestore.change_streams
WHERE projectsId = '{{ projectsId }}' -- required
AND databasesId = '{{ databasesId }}' -- required
;
INSERT examples
- create
- Manifest
Creates a new change stream for the database.
INSERT INTO google.firestore.change_streams (
data__collectionGroupScope,
data__databaseScope,
data__etag,
data__name,
data__retentionPeriod,
projectsId,
databasesId,
changeStreamId
)
SELECT
'{{ collectionGroupScope }}',
'{{ databaseScope }}',
'{{ etag }}',
'{{ name }}',
'{{ retentionPeriod }}',
'{{ projectsId }}',
'{{ databasesId }}',
'{{ changeStreamId }}'
RETURNING
name,
collectionGroupScope,
createTime,
databaseScope,
etag,
retentionPeriod,
startTime,
updateTime
;
# Description fields are for documentation purposes
- name: change_streams
props:
- name: projectsId
value: "{{ projectsId }}"
description: Required parameter for the change_streams resource.
- name: databasesId
value: "{{ databasesId }}"
description: Required parameter for the change_streams resource.
- name: collectionGroupScope
description: |
If set, the change stream is scoped to a collection group.
value:
collectionGroupId: "{{ collectionGroupId }}"
- name: databaseScope
value: "{{ databaseScope }}"
description: |
If set, the change stream is scoped to the entire database.
- name: etag
value: "{{ etag }}"
description: |
Optional. An etag used to determine which version of the configuration is being edited.
- name: name
value: "{{ name }}"
description: |
Identifier. The external resource name of the change stream. Format `projects/{project}/databases/{database}/changeStreams/{change_stream}`
- name: retentionPeriod
value: "{{ retentionPeriod }}"
description: |
Required. The retention period of the change stream. This is the amount of time a change event is available on the change stream. Must be from 1 to 7 days, inclusive. The retention_period must be in day granularity, i.e. it must be a multiple of 24 hours.
- name: changeStreamId
value: "{{ changeStreamId }}"
DELETE examples
- delete
Deletes a change stream.
DELETE FROM google.firestore.change_streams
WHERE projectsId = '{{ projectsId }}' --required
AND databasesId = '{{ databasesId }}' --required
AND changeStreamsId = '{{ changeStreamsId }}' --required
AND etag = '{{ etag }}'
;