IjzerenHein / firestorter

Use Google Firestore in React with zero effort, using MobX 🤘
http://firestorter.com
MIT License
378 stars 50 forks source link

Add support for deleting fields from documents #20

Closed IjzerenHein closed 6 years ago

IjzerenHein commented 6 years ago

Currently, deleting fields from a Document is not possible when using schemas. Without schemas it is possible by using firebase.firestore.FieldValue.delete() in the Document.update/set functions, although this is a bit of a cumbersome API.

Proposal API that treats undefined as a special value to delete a field.

doc.update({
  status: undefined // this will delete the field status
});

Additional requirements/info:

IjzerenHein commented 6 years ago

This issue has already been resolved. To delete fields from documents use:

const { getFirebase } from 'firestorter';
doc.update({
  memberCount: getFirebase().firestore.FieldValue.delete()
});