wixData.get() not working.

@wix-expert-velo-cert The reason for the error is that the .then function needs to be immediately after the wixData.get. You have a couple console.log calls in between.

However, it doesn’t look like you need to " get " the information because you already have it - from the query above. r.items[index] would be the same as the get result. It’s the whole collection record.

The update function requires that the object that you’re updating it with have all the values for all the fields. If you try to update only one field, you’ll lose the previous values of the other fields in the collection record.

Lastly, the good news is that you can use bulkUpdate in this case. Let the whole kdtransfirm assignment loop run and do the bulkUpdate afterwards using the modified query result array. That way, it will be quicker since you won’t be making so many calls to the data server.

 wixData.query("kisaandiary")
.eq("_owner", wixUsers.currentUser.id) 
.find().then(r=>{
   for(var index =0; index < r.items.length ; index++){
      r.items[index].kdtransfirm =$w('#input1').value;// updated last name
   }
   wixData.bulkUpdate("kisaandiary", r.items)
   .then((bulkResult) => {
      console.log(bulkResult);
   })
})