Skip to main content

change_streams

Creates, updates, deletes, gets or lists a change_streams resource.

Overview​

Namechange_streams
TypeResource
Idgoogle.firestore.change_streams

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringIdentifier. The external resource name of the change stream. Format projects/{project}/databases/{database}/changeStreams/{change_stream}
collectionGroupScopeobjectIf set, the change stream is scoped to a collection group. (id: GoogleFirestoreAdminV1CollectionGroupScope)
createTimestring (google-datetime)Output only. The time the Change Stream was created.
databaseScopeobjectIf set, the change stream is scoped to the entire database. (id: GoogleFirestoreAdminV1DatabaseScope)
etagstringOptional. An etag used to determine which version of the configuration is being edited.
retentionPeriodstring (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.
startTimestring (google-datetime)Output only. The time the Change Stream started recording events.
updateTimestring (google-datetime)Output only. The time the Change Stream was last updated.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, databasesId, changeStreamsIdGets information about a change stream.
listselectprojectsId, databasesIdLists all change streams in a database.
createinsertprojectsId, databasesIdchangeStreamIdCreates a new change stream for the database.
deletedeleteprojectsId, databasesId, changeStreamsIdetagDeletes 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.

NameDatatypeDescription
changeStreamsIdstring
databasesIdstring
projectsIdstring
changeStreamIdstring
etagstring

SELECT examples​

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
;

INSERT examples​

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
;

DELETE examples​

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 }}'
;