I'm new to Firebase and tried following this video.
code:
const functions = require("firebase-functions");
const admin = require("firebase-admin");
admin.initializeApp()
const db = admin.firestore()
exports.onUserCreate = functions.firestore.document('users/{userId}').onCreate(async(snapshot, context) => {
const values = snapshot.data()
await db.collection('logging').add({description: `Email was sent to user with username:${values.username}`}) })
This should create a new collection called 'logging' whenever a new collection is created. But the trigger doesn't work in emulator, it shows only the collection which we created.