Firestore Delete Map/Nested Field (Android)

October 21, 2019
val firestore = FirebaseFirestore.getInstance()

val docRef = firestore.collection("COLLECTION_NAME").document("DOC_ID")

docRef.update(docRef, mapOf{
    "address" to FieldValue.delete(),           // delete field
    "person.name" to FieldValue.delete(),       // delete nested field
    "favorites.item_id" to FieldValue.delete(), // delete map field
    "friends" to FieldValue.arrayRemove("John") // remove from array/list
    })
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.