This template shows how to copy data from the Realtime Database (such as logs being written there) to Google Cloud's BigQuery.
See file functions/index.js for the code.
The dependencies are listed in functions/package.json.
As an example we'll be using a simple logs database structure:
/functions-project-12345
/logs
/key-123456
text: "User signed in."
/key-123457
text: "Error: Could not connect to Database"
Set the bigquery.datasetName
and bigquery.tableName
Google Cloud environment variables to match the Dataset name and the Table name where you want the logs written to. For this use:
firebase functions:config:set bigquery.datasetName="bar" bigquery.tableName="baz"