Unable to bulk update in indexDb data using jsstore

64 Views Asked by At

I am using Indexdb in my project. I am performing an IndexDB operation using JSstore. I am able to perform all operations. But am unable to bulk update. can anyone help me with how can I update bulk updates using IndexDB?

I am able to update a single update like below

updateEmployeeById(id, updateData) {
        return this.connection.update({ in: this.M_EMP,
            set: updateData,
            where: {
                id: id
            }
        })
}

I am trying to update data using looping. But not able to update. My data and method is below

var arr = [
        {
            "age": 22,
            "company": "ACLIMdfsdfsdfdsfA",
            "email": "[email protected]",
            "gender": "male",
            "id": 1
        },
        {
            "age": 22,
            "company": "sssss",
            "email": "[email protected]",
            "gender": "malde",
            "id": 2
        }
    ]
     bulkUpdateEmployee(dataArr){
            dataArr.forEach((element, index) => {
               this.connection.update({ in: this.M_EMP,
                    set: {company: element.company},
                    where: {
                        id: element.id
                    }
                })
            });
        }
0

There are 0 best solutions below