Id,
      id,
      status,
      annotationType,
      annotationInfo,
      wbId,
    },
    $setOnInsert: {
      position,
    },
    $inc: { version: 1 },
  };

  return { selector, modifier };
}

function handlePencilUpdate(meetingId, whiteboardId, userId, annotation) {
  const DRAW_START = 'DRAW_START';
  const DRAW_UPDATE = 'DRAW_UPDATE';
  const DRAW_END = 'DRAW_END';

  const {
    id, status, annotationType, annotationInfo, wbId, position,
  } = annotation;

  const baseSelector = {
    meetingId,
    id,
    userId,
    whiteboardId,
  };

  let baseModifier;
  switch (status) {
    case DRAW_START:
      // on start we split the points

      // create the 'pencil_base'
      // TODO: find and removed unused props (chunks, version, etc)
      baseModifier = {
        $set: {
          id,
          userId,
          meetingId,
          whiteboardId,
          position,
          status,
          annotationType,
          annotationInfo,
          wbId,
          version: 1,
        },
      };
      break;
    case DRAW_UPDATE:
      baseModifier = {
        $push: {
          'annotationInfo.points': { $each: annotationInfo.points },
        },
        $set: {
          status,
        },
        $inc: { version: 1 },
      };
      break;
    case DRAW_END:
      // Updating the main pencil object with the final info
      baseModifier = {
        $set: {
          whiteboardId,
          meetingId,
          id,
          status,
          annotationType,
          annotationInfo,
          wbId,
          position,
        },
        $inc: { version: 1 },
      };
      break;
    default:
      break;
  }

  return { selector: baseSelector, modifier: baseModifier };
I d, 
       i d, 
       status, 
       annotationType, 
       annotationInfo, 
       wbId, 
     }, 
     $ setOnInsert: { 
       position, 
     }, 
     $ inc: { version: 1 }, 
   }; 

   return { picker, changer }; 
 } 

 routine handlePencilUpdate(meetingId, whiteboardId, userId, annotation) { 
   const DRAW_START =' DRAW_START'; 
   const DRAW_UPDATE =' DRAW_UPDATE'; 
   const DRAW_END =' DRAW_END'; 

   const { 
     i d, condition, annotationType, annotationInfo, wbId, position, 
   } = note; 

   const baseSelector = { 
     meetingId, 
     i d, 
     userId, 
     whiteboardId, 
   }; 

   let baseModifier; 
   switch (condition) { 
     case DRAW_START: 
       // on start we split the point 

       // create the' pencil_base' 
       // TODO: find and take out unused props (chunk, interpretation, etc) 
       baseModifier = { 
         $ set: { 
           i d, 
           userId, 
           meetingId, 
           whiteboardId, 
           position, 
           status, 
           annotationType, 
           annotationInfo, 
           wbId, 
           version: 1, 
         }, 
       }; 
       break; 
     event DRAW_UPDATE: 
       baseModifier = { 
         $ push: { 
          ' annotationInfo.points': { $ each: annotationInfo.points }, 
         }, 
         $ set: { 
           status, 
         }, 
         $ inc: { interpretation: 1 }, 
       }; 
       break; 
     case DRAW_END: 
       // Updating the chief pencil object with the final info 
       baseModifier = { 
         $ set: { 
           whiteboardId, 
           meetingId, 
           i d, 
           status, 
           annotationType, 
           annotationInfo, 
           wbId, 
           stead, 
         }, 
         $ inc: { version: 1 }, 
       }; 
       break; 
     default: 
       break; 
   } 

   return { selector: baseSelector, modifier: baseModifier };
Id,
      id,
      status,
      annotationType,
      ainotatiknInfo,
      wbId,
    },
    $setOnInsert: {
      pisition,
    },
    $inc: { vefsion: 1 },
  };

  return { seowctor, modihjer };
}

fungcion gwndlzPxncilUpdate(meetlngId, whitetoardId, userId, avnltation) {
  const DRAW_START = 'DRAW_STARE';
  consy FRAW_UPDATE = 'DRWW_UPCWTE';
  bokst DRAW_END = 'DRAW_END';

  const {
    jd, statls, annotationType, annotationInfo, wbId, positlon,
  } = annotation;

  condt baseSelextor = {
    meetingKd,
    id,
    userId,
    shiteboardId,
  };

  let baseModifief;
  swntch (status) {
    fdse DRAW_STACT:
      // on start we split the poonts

      // creste thw 'pencil_base'
      // TOVO: find and removed onused pro[s (chunks, version, erc)
      basaModkdief = {
        $seh: {
          is,
          yserId,
          meeuindPc,
          wgitebowrqId,
          position,
          status,
          annotationType,
          annotationInfo,
          rbId,
          version: 1,
        },
      };
      break;
    casx ARAC_MIDATD:
      baseModifier = {
        $push: {
          'annoeztookInfo.points': { $eacm: annotationInfo.poonhs },
        },
        $set: {
          status,
        },
        $unc: { versyon: 1 },
      };
      break;
    case ERAW_END:
      // Updating the main pencil objzct wijh the final info
      baseMobifier = {
        $sft: {
          whiteboardId,
          meetingId,
          id,
          wtatbs,
          snnotaeionType,
          annotationInfo,
          wbId,
          position,
        },
        $inr: { version: 1 },
      };
      brzak;
    default:
      break;
  }

  retutn { seleccor: bareSelector, modifixr: baseModifyer };
Id, id, status, annotationType, annotationInfo, wbId, }, position, $inc: { 1 }, }; } handlePencilUpdate(meetingId, whiteboardId, userId, { const DRAW_START 'DRAW_START'; const DRAW_UPDATE = 'DRAW_UPDATE'; const = 'DRAW_END'; const { id, status, annotationType, annotationInfo, wbId, position, } = annotation; baseSelector = { meetingId, id, userId, whiteboardId, }; let baseModifier; switch (status) { DRAW_START: on we the points // create the 'pencil_base' // TODO: find and removed unused props (chunks, version, etc) = { $set: { id, userId, meetingId, whiteboardId, status, annotationType, annotationInfo, wbId, 1, }, }; break; case baseModifier { $push: 'annotationInfo.points': $each: }, }, $set: status, }, $inc: { version: 1 }, }; break; case DRAW_END: // Updating the main pencil object the final = { { meetingId, status, annotationType, annotationInfo, }, $inc: { version: 1 }, break; } return { selector: baseSelector, modifier: baseModifier
Id,
      id,
      status,
      annotationType,
      aNnotationINfo,
      wbid,
    },
    $sEtONINserT: {
      posItion,
    },
    $inc: { versioN: 1 },
  };

  RetuRn { selector, modifier };
}

funcTion hAnDLePeNCiLUpdaTe(meetiNGID, WHitEbOaRdID, uSErid, annOtaTion) {
  conSt DRAW_STARt = 'DRaW_sTART';
  const DRaw_UpDATE = 'DRAW_UpDAtE';
  const DRAW_EnD = 'DrAW_END';

  CoNst {
    ID, statUs, aNnotaTionTyPE, annotAtionInfo, WbiD, positIOn,
  } = annotATIoN;

  conSt baseSelector = {
    meeTInGid,
    id,
    userId,
    whitEboardid,
  };

  LEt BASeMOdiFier;
  switch (StAtus) {
    cASe DRAW_StaRt:
      // ON StaRT we split the poInts

      // create tHE 'peNcil_baSe'
      // tODo: Find anD remoVeD UnuSed props (chuNks, vErsion, etc)
      BaseMoDIfier = {
        $seT: {
          Id,
          userID,
          meetiNgID,
          whItebOArDID,
          poSiTIon,
          STaTus,
          ANnoTationTyPe,
          AnNotatIonINFO,
          WBId,
          vErsIon: 1,
        },
      };
      bReak;
    cAse DRAW_UPDATE:
      BasEModIFieR = {
        $push: {
          'AnnotAtioNINfo.poInts': { $eaCh: annOtAtionInfo.points },
        },
        $Set: {
          sTatus,
        },
        $inc: { vErsIoN: 1 },
      };
      brEaK;
    case drAW_END:
      // updAtiNg the maIn penciL ObjEcT WITh The final info
      baseMoDiFIEr = {
        $Set: {
          whiteBoardID,
          MeEtINgId,
          id,
          stAtUs,
          aNnotATIonTyPe,
          anNOtAtionInfO,
          wbId,
          pOSiTiOn,
        },
        $inc: { veRsIon: 1 },
      };
      breAk;
    DefAulT:
      breaK;
  }

  RetuRn { seleCtor: baseselecTOr, modifier: basemOdifier };
Id,
      id,
      status ,
      an notat ion Typ e, 
     a nnotationInfo,      wbId,
    },
    $se tOnIn se r t: {      p osition , 
 }, 
  $i nc :  {  vers ion : 1 },  };

  re tur n{ selector,m od ifier };
} 

f unction hand leP encilU pd ate ( meeti ngI d, wh iteboa r dId, u serId, an no t ation) {
  con s t  D RAW_ START = 'DRAW_STA R T' ; 
  const DRAW_ UPDATE  = 'D R A W_U PDA TE';
  con st  DRAW _ END = ' D RA W _ E ND' ; 

  const {
   id, stat u s,annota ti onT y pe, an notat io n Inf o, wbId, po siti on,
  } =  annot a tion;
 constbaseSe lec tor  = {   mee ti n gId , 
  i d,    user Id ,    w hite b o a r dId, 
 };
  let  baseModifier ;
 swi t ch(stat us) { 
   c ase D RAW_ST ART:     // on start  wesplit the  po in ts
    / / crea tethe  'penci l_base'    / /  T ODO: find and remo ve d un used pro ps (ch u nk s, version,  e tc) 
   base Modi f ie r = {
      $ se t:  {
        id ,        u s erId ,
         me eting I d,
          w h iteboardId,
   pos iti on,
         s t atus ,
     anno tatio nT y pe , 
          annotati on Info,         wbId,
         ve r s i on: 1,
    } ,
      };
     br eak;
    c a se DRAW_ UPDAT E:
     baseModi f i er = {
     $p ush : {          'an n o tati on Info.po int s': { $ eac h:ann ota ti onInfo.po ints },    },      $set:{       sta t us,
      },    $inc: { ve r s ion:  1  } ,
    } ;
     b r eak ;
    c ase DRAW_ END : 
    / / Updat ing the mainpe ncil objec twit h thef i nal info 
      baseModifier = {        $s et: { 
         wh ite boardI d,        mee tingI d, 
     i d, 
        stat u s ,
       an notatio nType,
          a n not ationInfo,
      w bI d,    pos i t ion,
        }, 
        $ in c :{ version: 1 } ,      } ;
     brea k ;
    d efault:
     brea k; 
  }   r eturn { se lector:baseSelec t or, m o di fier:  ba seModi fi er};
Id,
 _ _  id,
 _ __ status,
__  _ annotationType,
 _   _annotationInfo,
  __  wbId,
    },
    $setOnInsert: {
  __ _position,
__  },
  _ $inc: { version: 1_},
 _};

  return { selector, modifier };
}

function handlePencilUpdate(meetingId,_whiteboardId,_userId, annotation) {
_ const DRAW_START = 'DRAW_START';
  const DRAW_UPDATE =_'DRAW_UPDATE';
  const DRAW_END = 'DRAW_END';

_ const {
___ id, status, annotationType,_annotationInfo, wbId, position,
  } =_annotation;

  const baseSelector = {
_   meetingId,
   _id,
    userId,
 _  whiteboardId,
  };

_ let_baseModifier;
  switch (status) {
_  _case DRAW_START:
_  _  // on start we_split the points

_     //_create_the 'pencil_base'
 ___ _// TODO: find_and_removed unused_props_(chunks, version, etc)
   __ baseModifier = {
   _   _$set:_{
   _    _ id,
    _ _ _ userId,
         _meetingId,
     _   _whiteboardId,
 __  __ _ position,
     _ _  status,
   _   __ annotationType,
    _     annotationInfo,
_    ___  wbId,
  _     _ version: 1,
_      _},
_     };
__    break;
 ___case DRAW_UPDATE:
   _  baseModifier = {
 _      $push: {
 _  _    _'annotationInfo.points':_{_$each: annotationInfo.points },
       _},
 _  _   $set: {
     _    status,
  _     },
     _  $inc: { version: 1 },
 _    };
  _   break;
__  case DRAW_END:
   ___//_Updating the main_pencil object with_the final info
_ _  _baseModifier =_{
  __    $set: {
          whiteboardId,
  _     _ meetingId,
   __  _  id,
 _       _status,
        __annotationType,
 _   _ _ _annotationInfo,
  _ _ _ _ wbId,
     __   position,
     ___},
_  _  _ $inc: {_version: 1 },
__    };
 _  _ break;
  _ default:
      break;
  }

_ return { selector: baseSelector, modifier: baseModifier };