lib/v0/mongoose-hook.js
function(pluginIdx) {
    if (pluginIdx >= plugins.length) return callback(hooks.collectionHook);

    var plugin = plugins[pluginIdx];
    var next = function() {iterPlugins(pluginIdx + 1);};
    var func = plugin[stage];

    // call the plugin's stage hook, if defined
    if (func) {
      // T is database operation object
      func.call(plugin, T, next);
    } else next();
  }
function(pluginIdx) {
    if (pluginIdx >= plugins.length) return callback(hooks.collectionHook);

    var plugin = plugins[pluginIdx];
    var next = function() {iterPlugins(pluginIdx + 1);};
    var func = plugin[stage];

    // call the plugin's stage hook, if defined
    if (func) {
      // T is database operation object
      func.call(plugin, T, next);
    } else next();
  }
function ( pluginIdx ) { if ( pluginIdx >= plugins . length ) return callback ( hooks . collectionHook ) ; var plugin = plugins [ pluginIdx ] ; var next = function ( ) { iterPlugins ( pluginIdx + 1 ) ; } ; var func = plugin [ stage ] ; // call the plugin's stage hook, if defined if ( func ) { // T is database operation object func . call ( plugin , T , next ) ; } else next ( ) ; }
iterate through the hook-based plugins
iterate through the hook - based plugins