database namespace

Functions

FunctionDescription
onValueCreated(ref, handler)Event handler which triggers when data is created in Realtime Database.
onValueCreated(opts, handler)Event handler which triggers when data is created in Realtime Database.
onValueDeleted(ref, handler)Event handler which triggers when data is deleted in Realtime Database.
onValueDeleted(opts, handler)Event handler which triggers when data is deleted in Realtime Database.
onValueUpdated(ref, handler)Event handler which triggers when data is updated in Realtime Database.
onValueUpdated(opts, handler)Event handler which triggers when data is updated in Realtime Database.
onValueWritten(ref, handler)Event handler which triggers when data is created, updated, or deleted in Realtime Database.
onValueWritten(opts, handler)Event handler which triggers when data is created, updated, or deleted in Realtime Database.

Classes

ClassDescription
DataSnapshotInterface representing a Firebase Realtime database data snapshot.

Interfaces

InterfaceDescription
DatabaseEventA CloudEvent that contains a DataSnapshot or a Change
RawRTDBCloudEvent
RawRTDBCloudEventData
ReferenceOptionsReferenceOptions extend EventHandlerOptions with provided ref and optional instance

database.onValueCreated()

Event handler which triggers when data is created in Realtime Database.

Signature:

exportdeclarefunctiononValueCreated<Refextendsstring>(ref:Ref,handler:(event:DatabaseEvent<DataSnapshot,ParamsOf<Ref>>)=>any|Promise<any>):CloudFunction<DatabaseEvent<DataSnapshot,ParamsOf<Ref>>>;

Parameters

ParameterTypeDescription
refRef
handler(event:DatabaseEvent<DataSnapshot,ParamsOf<Ref>>) => any | Promise<any>Event handler which is run every time a Realtime Database create occurs.

Returns:

CloudFunction<DatabaseEvent<DataSnapshot,ParamsOf<Ref>>>

database.onValueCreated()

Event handler which triggers when data is created in Realtime Database.

Signature:

exportdeclarefunctiononValueCreated<Refextendsstring>(opts:ReferenceOptions<Ref>,handler:(event:DatabaseEvent<DataSnapshot,ParamsOf<Ref>>)=>any|Promise<any>):CloudFunction<DatabaseEvent<DataSnapshot,ParamsOf<Ref>>>;

Parameters

ParameterTypeDescription
optsReferenceOptions<Ref>Options that can be set on an individual event-handling function.
handler(event:DatabaseEvent<DataSnapshot,ParamsOf<Ref>>) => any | Promise<any>Event handler which is run every time a Realtime Database create occurs.

Returns:

CloudFunction<DatabaseEvent<DataSnapshot,ParamsOf<Ref>>>

database.onValueDeleted()

Event handler which triggers when data is deleted in Realtime Database.

Signature:

exportdeclarefunctiononValueDeleted<Refextendsstring>(ref:Ref,handler:(event:DatabaseEvent<DataSnapshot,ParamsOf<Ref>>)=>any|Promise<any>):CloudFunction<DatabaseEvent<DataSnapshot,ParamsOf<Ref>>>;

Parameters

ParameterTypeDescription
refRef
handler(event:DatabaseEvent<DataSnapshot,ParamsOf<Ref>>) => any | Promise<any>Event handler which is run every time a Realtime Database deletion occurs.

Returns:

CloudFunction<DatabaseEvent<DataSnapshot,ParamsOf<Ref>>>

database.onValueDeleted()

Event handler which triggers when data is deleted in Realtime Database.

Signature:

exportdeclarefunctiononValueDeleted<Refextendsstring>(opts:ReferenceOptions<Ref>,handler:(event:DatabaseEvent<DataSnapshot,ParamsOf<Ref>>)=>any|Promise<any>):CloudFunction<DatabaseEvent<DataSnapshot,ParamsOf<Ref>>>;

Parameters

ParameterTypeDescription
optsReferenceOptions<Ref>Options that can be set on an individual event-handling function.
handler(event:DatabaseEvent<DataSnapshot,ParamsOf<Ref>>) => any | Promise<any>Event handler which is run every time a Realtime Database deletion occurs.

Returns:

CloudFunction<DatabaseEvent<DataSnapshot,ParamsOf<Ref>>>

database.onValueUpdated()

Event handler which triggers when data is updated in Realtime Database.

Signature:

exportdeclarefunctiononValueUpdated<Refextendsstring>(ref:Ref,handler:(event:DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>)=>any|Promise<any>):CloudFunction<DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>>;

Parameters

ParameterTypeDescription
refRef
handler(event:DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>) => any | Promise<any>Event handler which is run every time a Realtime Database update occurs.

Returns:

CloudFunction<DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>>

database.onValueUpdated()

Event handler which triggers when data is updated in Realtime Database.

Signature:

exportdeclarefunctiononValueUpdated<Refextendsstring>(opts:ReferenceOptions<Ref>,handler:(event:DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>)=>any|Promise<any>):CloudFunction<DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>>;

Parameters

ParameterTypeDescription
optsReferenceOptions<Ref>Options that can be set on an individual event-handling function.
handler(event:DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>) => any | Promise<any>Event handler which is run every time a Realtime Database update occurs.

Returns:

CloudFunction<DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>>

database.onValueWritten()

Event handler which triggers when data is created, updated, or deleted in Realtime Database.

Signature:

exportdeclarefunctiononValueWritten<Refextendsstring>(ref:Ref,handler:(event:DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>)=>any|Promise<any>):CloudFunction<DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>>;

Parameters

ParameterTypeDescription
refRef
handler(event:DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>) => any | Promise<any>Event handler which is run every time a Realtime Database create, update, or delete occurs.

Returns:

CloudFunction<DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>>

database.onValueWritten()

Event handler which triggers when data is created, updated, or deleted in Realtime Database.

Signature:

exportdeclarefunctiononValueWritten<Refextendsstring>(opts:ReferenceOptions<Ref>,handler:(event:DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>)=>any|Promise<any>):CloudFunction<DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>>;

Parameters

ParameterTypeDescription
optsReferenceOptions<Ref>Options that can be set on an individual event-handling function.
handler(event:DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>) => any | Promise<any>Event handler which is run every time a Realtime Database create, update, or delete occurs.

Returns:

CloudFunction<DatabaseEvent<Change<DataSnapshot>,ParamsOf<Ref>>>

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-04-18 UTC.