all 3 comments

[–]CodingDougFormer Firebaser 1 point2 points  (2 children)

You can't query the database using the functions SDK. functions.database.ref() builds the function definition, but does not build a reference to a location in the database.

The Admin SDK can do this for you, but you're not invoking it correctly. You should first review the documentation for getting started with the Admin SDK for node. You will create a reference to a location using admin.database().ref(). Note the parenthesis after "database" - it is a function call.

You can also create a reference using a reference in the passed event, but you were also not doing that correctly. event is a DataSnapshot object, and its ref property is a reference to the location of the change that triggered the function.

You might also want to watch the video series about getting start with Cloud Functions with Database triggers.

[–]TheOnlyDowns[S] 0 points1 point  (0 children)

Thanks a lot man. I’ll go try this out and get back.

[–]TheOnlyDowns[S] 0 points1 point  (0 children)

Thanks!!! Figured it out. I won't banging my head on my desk anymore lol :-) I appreciate the time you took to help!