My goal is to create a trigger functions that listens to updates/changes being made in a subcollection inside of firebase.
Here's how the firebase database is structured. There's a collection named "searchRequests"(PARENT COLLECTION), with the sub-collection named "offers" with the data that i'll like to trigger when a change or update has been made inside the "status" field. image of my firebase database image of firebase database with subcollection
Here's what I have tried so far and many other options but no luck. Hoping a fellow mate from StackOverflow could help :)
const functions = require("firebase-functions");
const admin = require('firebase-admin')
admin.initializeApp()
exports.sendEmailforNewBid = functions.firestore.document('offers/{projectId}')
.onUpdate((snap,ctx)=>{
const data=snap.data();
});