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

    let readableFields = []

    let fields = model.schema.paths

    for (let fieldName in fields) {
      let field = fields[fieldName].options
      if (!field.exclude && fieldName !== '__v') {
        readableFields.push(fieldName)
      }
    }

    return readableFields
  }
function(model, logger) {
    // This line has to come first
    validationHelper.validateModel(model, logger)

    let readableFields = []

    let fields = model.schema.paths

    for (let fieldName in fields) {
      let field = fields[fieldName].options
      if (!field.exclude && fieldName !== '__v') {
        readableFields.push(fieldName)
      }
    }

    return readableFields
  }
function ( model , logger ) { // This line has to come first validationHelper . validateModel ( model , logger ) let readableFields = [ ] let fields = model . schema . paths for ( let fieldName in fields ) { let field = fields [ fieldName ] . options if ( ! field . exclude && fieldName !== '__v' ) { readableFields . push ( fieldName ) } } return readableFields }
Get a list of fields that can be returned as part of a query result.
@param model: A mongoose model object.
@param logger: A logging object.
@returns {Array}: A list of fields.
Get a list of fields that can be returned as part of a query result .