utilities/query-helper.js
function(query, mongooseQuery, logger) {
    const Log = logger.bind()
    if (query.$page) {
      mongooseQuery = this.setPage(query, mongooseQuery, Log)
    } else {
      mongooseQuery = this.setSkip(query, mongooseQuery, Log)
    }

    mongooseQuery = this.setLimit(query, mongooseQuery, Log)

    return mongooseQuery
  }
function(query, mongooseQuery, logger) {
    const Log = logger.bind()
    if (query.$page) {
      mongooseQuery = this.setPage(query, mongooseQuery, Log)
    } else {
      mongooseQuery = this.setSkip(query, mongooseQuery, Log)
    }

    mongooseQuery = this.setLimit(query, mongooseQuery, Log)

    return mongooseQuery
  }
function ( query , mongooseQuery , logger ) { const Log = logger . bind ( ) if ( query . $page ) { mongooseQuery = this . setPage ( query , mongooseQuery , Log ) } else { mongooseQuery = this . setSkip ( query , mongooseQuery , Log ) } mongooseQuery = this . setLimit ( query , mongooseQuery , Log ) return mongooseQuery }
Handle pagination for the query if needed.
@param query: The incoming request query.
@param mongooseQuery: A mongoose query.
@param logger: A logging object.
@returns {*}: The updated mongoose query.
Handle pagination for the query if needed .