I'm working on a Firestore DB that uses collectionGroups.
The collectionGroup in question is a collection of 'Fights'.
When a new fight is created I would like to use the onCreate method in a cloud function to watch for new 'Fight' entries and then add some meta data to them. Ideally It would look something like the pseudo code below
export const placeFightersInEvent = functions.firestore
.collectionGroup('fights/{fightId}')
.onCreate(async (fightSnapshot, context) => {
// get metadata and add to the newly created 'fight'
});
I'm using the most up to date versions of the firebase functions and admin sdk but I can't seem to find an available function to do this. Is it possible to watch collection groups in this way?