Snippets Collections
// calling    
        StrutName.updateDocument("Users", "", dataToUpdate) { (isUpdated) in
            if isUpdated {
                    print("Success")
            } else {
                print("Found Error While Updating")
            }
        }

    public static func updateDocument (_ collectionName: String, _ documentId : String, _ dataToUpdate: [String: Any], completionHandler:@escaping (_ success:Bool) -> Void) {
        
        var documentID = ""
        
        SVProgressHUD.show()
        let User = Auth.auth().currentUser
        guard let user = User else {
            SVProgressHUD.dismiss()
            completionHandler(false)
            return
        }
        
        if documentId == "" {
            documentID = user.uid
        } else {
            documentID = documentId
        }
        
        let db = Firestore.firestore()
        db.collection(collectionName).document(documentID).setData(dataToUpdate, merge: true) { (error) in
            
            if error != nil {
                completionHandler(false)
                SVProgressHUD.dismiss()
                return
            }
            print("updated321")
            completionHandler(true)
            SVProgressHUD.dismiss()
        }
    }
        let dataToUpdate = [
            "certificationsList" : FieldValue.arrayUnion (
                [[ "company": certificate.company,
                   "title" : certificate.title,
                   "startDate" : startDate1,
                   "endDate" : endDate1
                ]])
              ]
        let dataToUpdate = [
            "languagesList" : FieldValue.arrayUnion(
                [[ "languageLevel": language.language_Level,
                "languageTitle" : language.language_Title  ]])
                                                    ]
@IBAction func saveChangesPressed(_ sender: UIButton) {
        
        let user = Auth.auth().currentUser
        if let user = user {
            let db = Firestore.firestore()
            let docRef = db.collection("Users").document(user.uid)
            docRef.updateData(["Name": self.nameField.text ?? "User","Email": self.emailField.text ?? "a@gmail.com", "MobileNumber": self.phoneNumberField.text ?? "123"])
        }
    }
UPDATE `qm_aktuelle_liste` SET params = JSON_INSERT(params, '$.ohneMangel', 'x') WHERE id <300

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension