public void AcceptFriend(string friendId) { DocumentReference documentReference = FirebaseBackend.FirebaseBackend .GetFireStore() .Collection("friends") .Document(currentUserID); documentReference.Update(friendId, true); DocumentReference documentReference2 = FirebaseBackend.FirebaseBackend .GetFireStore() .Collection("friends") .Document(friendId); documentReference2.Update(currentUserID, true); DocumentReference documentReference3 = FirebaseBackend.FirebaseBackend .GetFireStore() .Collection("invitations") .Document(currentUserID); documentReference3.Update(friendId, FieldValue.Delete()); }
public void DeleteInvitation(string friendId) { DocumentReference documentReference3 = FirebaseBackend.FirebaseBackend .GetFireStore() .Collection("invitations") .Document(currentUserID); documentReference3.Update(friendId, FieldValue.Delete()); }
// when user deletes the alarm private void DeleteAlarmTime(Treatment treatment) { var db = _userService.GetDatabase(this); IDictionary <string, Java.Lang.Object> mapTreatment = new Dictionary <string, Java.Lang.Object>(); mapTreatment["alarmTime"] = FieldValue.Delete(); TaskCompletionListener deleteAlarmListener = new TaskCompletionListener(); deleteAlarmListener.Succes += DeleteAlarmListener_Succes; deleteAlarmListener.Failure += DeleteAlarmListener_Failure; db.Collection("Medics").Document(clientLogged.MedicSubscribed.Id).Collection("Clients").Document(clientLogged.Id).Collection("Treatments") .Document(treatment.Id).Update(mapTreatment).AddOnSuccessListener(deleteAlarmListener).AddOnFailureListener(deleteAlarmListener); }
public void OnSuccess(Java.Lang.Object result) { var snapshot = (DocumentSnapshot)result; if (snapshot.Exists()) { DocumentReference documentReference = FirebaseBackend.FirebaseBackend .GetFireStore() .Collection("friends") .Document(Helpers.Helper.GetUserId()); documentReference.Update(userId, FieldValue.Delete()); DocumentReference documentReference2 = FirebaseBackend.FirebaseBackend .GetFireStore() .Collection("friends") .Document(userId); documentReference2.Update(Helpers.Helper.GetUserId(), FieldValue.Delete()); } }
public async Task deletes_fields_of_document() { var sut = CrossFirebaseFirestore.Current; var pokemon = PokemonFactory.CreateCharmander(); var path = $"testing/{pokemon.Id}"; var document = sut.GetDocument(path); await document.SetDataAsync(pokemon); await document.UpdateDataAsync( ("moves", FieldValue.Delete()), ("evolutions", FieldValue.Delete()), ("first_sighting_location", FieldValue.Delete()), ("poke_type", FieldValue.Delete())); var snapshot = await document.GetDocumentSnapshotAsync <Pokemon>(); Assert.Null(snapshot.Data.Moves); Assert.Null(snapshot.Data.FirstSightingLocation); Assert.Null(snapshot.Data.Evolutions); Assert.Equal(PokeType.Undefined, snapshot.Data.PokeType); }