Reputation: 12813
According to the Firestore docs one can do the following:
var cityRef = db.collection('cities').doc('BJ');
// Remove the 'capital' field from the document
var removeCapital = cityRef.update({
capital: firebase.firestore.FieldValue.delete()
});
However, using AngularFirestore, FieldValue
is not available:
How can one remove a field using AngularFirestore?
Edit:
Upvotes: 2
Views: 1223
Reputation: 182
For Angular12 / Firebase 9 / AngularFire 7 imports should looks like:
import firebase from 'firebase/compat/app';
import 'firebase/compat/firestore';
and then
fieldName : firebase.firestore.FieldValue.delete()
Upvotes: 1
Reputation: 520
To use the FieldValue.delete() method you have to import:
import * as firebase from 'firebase/app';
or as camden_kid suggested:
import { firestore } from 'firebase/app';
Upvotes: 3