utilities/query-helper.js
function getReference(model, embed, logger) {
  let property = model.schema.obj[embed]
  while (_.isArray(property)) {
    property = property[0]
  }
  if (property && property.ref) {
    return {
      model: property.ref,
      include: { model: globals.mongoose.model(property.ref), as: embed }
    }
  } else {
    return null
  }
}
function getReference(model, embed, logger) {
  let property = model.schema.obj[embed]
  while (_.isArray(property)) {
    property = property[0]
  }
  if (property && property.ref) {
    return {
      model: property.ref,
      include: { model: globals.mongoose.model(property.ref), as: embed }
    }
  } else {
    return null
  }
}
function getReference ( model , embed , logger ) { let property = model . schema . obj [ embed ] while ( _ . isArray ( property ) ) { property = property [ 0 ] } if ( property && property . ref ) { return { model : property . ref , include : { model : globals . mongoose . model ( property . ref ) , as : embed } } } else { return null } }
Creates an association object from a model property if the property is a reference id
@param model
@param embed
@param logger
@returns {*} The association object or null if no reference is found
Creates an association object from a model property if the property is a reference id