Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete Field in Firestore Document

how to delete a Document Field in Cloud Firestore? ... I'm using the code below but I can not.

this.db.doc(`ProfileUser/${userId}/followersCount/FollowersCount`).update({  [currentUserId]: firebase.firestore.FieldValue.delete()}) 

Anyone know how to do it?

like image 374
Juliano JC Avatar asked Oct 27 '17 22:10

Juliano JC


1 Answers

You can try as shown below:

// get the reference to the doc let docRef=this.db.doc(`ProfileUser/${userId}/followersCount/FollowersCount`);  // remove the {currentUserId} field from the document let removeCurrentUserId = docRef.update({     [currentUserId]: firebase.firestore.FieldValue.delete() }); 
like image 153
Sampath Avatar answered Oct 05 '22 12:10

Sampath