Get and update collection wix code

Hi, I have some code to get and update the code, but it doesn’t seem to be working.
Here’s the code:

wixData.get("AppHours", fid)
  .then( (item) => {
 let ma9 = false;
 let di9 = false;
 let wo9 = false;
 let do9 = false;
 let vr9 = false;
 let za9 = false;
 let zo9 = false;
 if ($w("#checkbox1").checked) {
      ma9 = true
 if ($w("#checkbox2").checked) {
      di9 = true
 if ($w("#checkbox3").checked) {
      wo9 = true
 if ($w("#checkbox4").checked) {
      do9 = true
 if ($w("#checkbox5").checked) {
      vr9 = true
 if ($w("#checkbox6").checked) {
      za9 = true
 if ($w("#checkbox7").checked) {
      zo9 = true

    item = {
 "ma9": ma9,
 "di9": di9,
 "wo9": wo9,
 "do9": do9,
 "vr9": vr9,
 "za9": za9,
 "zo9": zo9,


    wixData.update("AppHours", item);
  } )
  .catch( (err) => {
 let errorMsg = err;
    console.log(err, errorMsg)
  } );

‘fid’ is the variable with the id of the item.
any idea why it doesn’t work?


The item object has to have an _id property included for the update function to know which record in the AppHours collection to update.

Hi thanks for your answer! So how do I do this than correctly?

I fixed it thanks!