utilities/query-helper.js
function(model, logger) {
    // This line has to come first
    validationHelper.validateModel(model, logger)
    const Log = logger.bind()

    let sortableFields = this.getReadableFields(model, Log)

    for (let i = sortableFields.length - 1; i >= 0; i--) {
      let descendingField = '-' + sortableFields[i]
      sortableFields.splice(i, 0, descendingField)
    }

    return sortableFields
  }
function(model, logger) {
    // This line has to come first
    validationHelper.validateModel(model, logger)
    const Log = logger.bind()

    let sortableFields = this.getReadableFields(model, Log)

    for (let i = sortableFields.length - 1; i >= 0; i--) {
      let descendingField = '-' + sortableFields[i]
      sortableFields.splice(i, 0, descendingField)
    }

    return sortableFields
  }
function ( model , logger ) { // This line has to come first validationHelper . validateModel ( model , logger ) const Log = logger . bind ( ) let sortableFields = this . getReadableFields ( model , Log ) for ( let i = sortableFields . length - 1 ; i >= 0 ; i -- ) { let descendingField = '-' + sortableFields [ i ] sortableFields . splice ( i , 0 , descendingField ) } return sortableFields }
Get a list of valid query sort inputs.
@param model: A mongoose model object.
@param logger: A logging object.
@returns {Array}: A list of fields.
Get a list of valid query sort inputs .