bin/cli.js
function(dbctrl, forcerebind) {
    var octrls = forcerebind ? [] : cchistory;
    var nctrls = [];

    var dbMeta = cdb.jb.getDBMeta();
    if (dbMeta && dbMeta.collections) {
        for (var j = 0; j < dbMeta.collections.length; ++j) {
            var collection = dbMeta.collections[j];
            var ci;
            if ((ci = octrls.indexOf(collection.name)) != -1) {
                nctrls.push(collection.name);
                octrls.splice(ci, 1);
            } else if (!dbctrl[collection.name]){
                nctrls.push(collection.name);
                dbctrl[collection.name] = colctl(dbctrl, collection.name);
            }
        }
    }
    for (var i = 0; i < octrls.length; ++i) {
        delete dbctrl[octrls[i]];
    }

    // save current known collections
    cchistory = nctrls;
}
function(dbctrl, forcerebind) {
    var octrls = forcerebind ? [] : cchistory;
    var nctrls = [];

    var dbMeta = cdb.jb.getDBMeta();
    if (dbMeta && dbMeta.collections) {
        for (var j = 0; j < dbMeta.collections.length; ++j) {
            var collection = dbMeta.collections[j];
            var ci;
            if ((ci = octrls.indexOf(collection.name)) != -1) {
                nctrls.push(collection.name);
                octrls.splice(ci, 1);
            } else if (!dbctrl[collection.name]){
                nctrls.push(collection.name);
                dbctrl[collection.name] = colctl(dbctrl, collection.name);
            }
        }
    }
    for (var i = 0; i < octrls.length; ++i) {
        delete dbctrl[octrls[i]];
    }

    // save current known collections
    cchistory = nctrls;
}
function ( dbctrl , forcerebind ) { var octrls = forcerebind ? [ ] : cchistory ; var nctrls = [ ] ; var dbMeta = cdb . jb . getDBMeta ( ) ; if ( dbMeta && dbMeta . collections ) { for ( var j = 0 ; j < dbMeta . collections . length ; ++ j ) { var collection = dbMeta . collections [ j ] ; var ci ; if ( ( ci = octrls . indexOf ( collection . name ) ) != - 1 ) { nctrls . push ( collection . name ) ; octrls . splice ( ci , 1 ) ; } else if ( ! dbctrl [ collection . name ] ) { nctrls . push ( collection . name ) ; dbctrl [ collection . name ] = colctl ( dbctrl , collection . name ) ; } } } for ( var i = 0 ; i < octrls . length ; ++ i ) { delete dbctrl [ octrls [ i ] ] ; } // save current known collections cchistory = nctrls ; }
bind collections controllers dbctrl - db controller forcerebind - if <code>true</code> force rebind all collection controllers, otherwise check added/deleted collections
bind collections controllers dbctrl - db controller forcerebind - if <code > true< / code > force rebind all collection controllers otherwise check added / deleted collections