src/services/sectionsService.js
/**
 * @description Update/upsert section document
 * @memberof sectionsService
 * @function updateSection
 * @returns updated mongo document
 */
@description Update/upsert section document
@memberof sectionsService
@function updateSection
@returns updated mongo document
@description Update / upsert section document @memberof sectionsService @function updateSection @returns updated mongo document
async function updateSection(req) {
  try {
    LOGGER.info(`Entering into updateSection() of :: ${FILE_NAME}`);
    const { body } = req;
    const query = {
      title: body.title,
    };
    const updateQuery = body;
    const projection = null;
    const upsertFlag = true;
    const arrayFilters = null;
    const result = await sectionsDAO.update(query, updateQuery, projection, upsertFlag, arrayFilters);
    LOGGER.info(`Success in updateSection() of :: ${FILE_NAME}`);
    return result;
  } catch (error) {
    LOGGER.error(`Error in updateSection() of :: ${FILE_NAME} :: ${error}`);
    throw new Error(error);
  }
}
async function updateSection ( req ) { try { LOGGER . info ( ` ${ FILE_NAME } ` ) ; const { body } = req ; const query = { title : body . title , } ; const updateQuery = body ; const projection = null ; const upsertFlag = true ; const arrayFilters = null ; const result = await sectionsDAO . update ( query , updateQuery , projection , upsertFlag , arrayFilters ) ; LOGGER . info ( ` ${ FILE_NAME } ` ) ; return result ; } catch ( error ) { LOGGER . error ( ` ${ FILE_NAME } ${ error } ` ) ; throw new Error ( error ) ; } }
@description Update/upsert section document
 @memberof sectionsService
 @function updateSection
 @returns updated mongo document
@description Update / upsert section document @memberof sectionsService @function updateSection @returns updated mongo document