I want to know how to update the individual document in a collection based on a search string in Firebase Cloud Firestore.
I have a collection "Recent", which has the following fields;
- id: primary key
- chatRoomId: key
- blockStatus: string (yes/ no)
I am able to list down the all the documents to update based on
db.collection("Recent").whereField("chatRoomId", isEqualTo: "value") .getDocuments() { (querySnapshot, err) in if let err = err { print("DEBUG: Error getting documents: \(err)") } else { for document in querySnapshot!.documents { print("DEBUG: \(document.documentID) => \(document.data())")
how do I update the documents in the collection for a field "blockStatus" based on my search of a string in field chatRoomId?
https://stackoverflow.com/questions/65774653/update-all-documents-in-a-collection-in-firestore-based-on-search-criteria-in-sw January 18, 2021 at 08:35PM
没有评论:
发表评论