use of com.google.cloud.firestore.FieldPath in project java-firestore by googleapis.
the class ITSystemTest method deleteNestedFieldUsingFieldPath.
@Test
public void deleteNestedFieldUsingFieldPath() throws Exception {
DocumentReference documentReference = randomColl.document("doc1");
documentReference.set(map("a.b", SINGLE_FILED_MAP_WITH_DOT)).get();
DocumentSnapshot documentSnapshots = documentReference.get().get();
assertEquals(SINGLE_FILED_MAP_WITH_DOT, documentSnapshots.getData().get("a.b"));
FieldPath path = FieldPath.of("a.b", "c.d");
documentReference.update(path, FieldValue.delete()).get();
documentSnapshots = documentReference.get().get();
assertNull(documentSnapshots.getData().get("c.d"));
}
Aggregations