Reputation: 11
I'm trying to delete a single field of a document via PATCH method in Firebase Firestore REST API but I can't find a value (or method) that represents "remove this field" like in Firebase Realtime database exist undefined
value to do that. Do you know how to achieve that?
Upvotes: 0
Views: 1094
Reputation: 317712
The Firestore REST API documentation for the patch method accepts a DocumentMask object. It has the following effect:
If the document exists on the server and has fields not referenced in the mask, they are left unchanged. Fields referenced in the mask, but not present in the input document, are deleted from the document on the server.
So, your mask should contain the fields to delete, and you should not give them a value in the request body.
Upvotes: 5