I am trying to remove a user from a map that I declared in the FireStore. But how do I get the field value? I think it should be something like this firestore.FieldValue.arrayRemove(user.uid) only firestore does not have the FieldValue object. How can I remove user from he users map?
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
const firestore = admin.firestore();
export const onUserDeleted = functions.region('europe-west1').auth.user().onDelete(async user => {
const groups = await firestore.collection('groups').where('users', 'array-contains', user.uid).get();
const promises : Promise<FirebaseFirestore.WriteResult>[] = [];
groups.forEach(snapshot => {
promises.push(snapshot.ref.update({
'users' : ,
}));
});
return await Promise.all(promises);
});