Reputation: 560
I have a Firestore Array that has typing users (as IDs) in it. My goal is to remove the current User from that chat when the app terminates. I have read this thread where Frank van Puffelen said that you can remove values on disconnect by using this code:
ref.child("Clients").child(user.uid).child("current_venue").onDisconnectRemoveValue()
My problem is that this code is only able to remove a child document from the database and not an array. Is there any way to call onDisconnectRemoveValue()
for a Firestore Array? Or is there any alternative for this case?
This is what my database structure looks like: Collection(Chats) -> Document(ChatID) -> Array(typingUsers)
Upvotes: 0
Views: 119
Reputation: 324
You can remove whatever values you want from firebase in your appDelegate under the function:
func applicationWillTerminate(_ application: UIApplication) {
// Remove the array
}
Upvotes: 0