lib/base/exec.js
function(resolve) {
    var self = this.chain()

    // if .find(null) was called
    if (self.getInternal('exec_null')) {
      return Promise.resolve(null)
    }

    var relation = self.getInternal('relation')

    if (relation && typeof relation.loadWithCollection === 'function') {
      const promise = relation.loadWithCollection(self)
      if (promise && promise.then) return promise.then(resolve)
    }

    var dataLoaded = self.getInternal('data_loaded')
    var options = self.getExecOptions()
    var data = {}

    if (dataLoaded) data.result = dataLoaded

    return self
      .callInterceptors('beforeFind', [options])
      .then(function() {
        return self.callInterceptors('onFind', [options, data], {
          executeInParallel: true
        })
      })
      .then(function() {
        return self.callInterceptors('afterFind', [data])
      })
      .then(function() {
        if (typeof resolve === 'function') return resolve(data.result)
        return data.result
      })
  }
function(resolve) {
    var self = this.chain()

    // if .find(null) was called
    if (self.getInternal('exec_null')) {
      return Promise.resolve(null)
    }

    var relation = self.getInternal('relation')

    if (relation && typeof relation.loadWithCollection === 'function') {
      const promise = relation.loadWithCollection(self)
      if (promise && promise.then) return promise.then(resolve)
    }

    var dataLoaded = self.getInternal('data_loaded')
    var options = self.getExecOptions()
    var data = {}

    if (dataLoaded) data.result = dataLoaded

    return self
      .callInterceptors('beforeFind', [options])
      .then(function() {
        return self.callInterceptors('onFind', [options, data], {
          executeInParallel: true
        })
      })
      .then(function() {
        return self.callInterceptors('afterFind', [data])
      })
      .then(function() {
        if (typeof resolve === 'function') return resolve(data.result)
        return data.result
      })
  }
function ( resolve ) { var self = this . chain ( ) // if .find(null) was called if ( self . getInternal ( 'exec_null' ) ) { return Promise . resolve ( null ) } var relation = self . getInternal ( 'relation' ) if ( relation && typeof relation . loadWithCollection === 'function' ) { const promise = relation . loadWithCollection ( self ) if ( promise && promise . then ) return promise . then ( resolve ) } var dataLoaded = self . getInternal ( 'data_loaded' ) var options = self . getExecOptions ( ) var data = { } if ( dataLoaded ) data . result = dataLoaded return self . callInterceptors ( 'beforeFind' , [ options ] ) . then ( function ( ) { return self . callInterceptors ( 'onFind' , [ options , data ] , { executeInParallel : true } ) } ) . then ( function ( ) { return self . callInterceptors ( 'afterFind' , [ data ] ) } ) . then ( function ( ) { if ( typeof resolve === 'function' ) return resolve ( data . result ) return data . result } ) }
Executes the find

@class Model
@method exec

@callback
@param {array|object} result - Either a Collection of records or a single Record
@this Collection
Executes the find