Skip to content

refactor(db)!: reference is now instance of a Database reference #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2023

Conversation

Salakar
Copy link
Member

@Salakar Salakar commented May 3, 2023

Formerly a string only.

Testing

Deployed the following function;

from firebase_functions import db_fn, options
from firebase_admin import initialize_app

initialize_app()

options.set_global_options(region=options.SupportedRegion.EUROPE_WEST1)


@db_fn.on_value_written(reference="hello/world", instance="a-non-default-database")
def onwriteexample(event: db_fn.Event[db_fn.Change]) -> None:
    print("Hello from db write event:", event)
    print("Reference.path:", event.reference.path)
    print("Reference.get():", event.reference.get())

Edited /hello/world on Firebase console to have the value "some data in my hello/world ref woo!", this successfully triggered, logs shown below (note the none default database instance and non default region used in the deployed code to verify correct instance is targetted by the ref):

image

image

@Salakar Salakar marked this pull request as ready for review May 3, 2023 16:47
@taeold taeold merged commit bc41f56 into firebase:main May 4, 2023
taeold added a commit that referenced this pull request May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants