lib/instance-detail-helper.js
function getInstanceDetail(client, db, done) {
  const tasks = {
    client: attach.bind(null, client),
    db: attach.bind(null, db),
    userInfo: ['client', 'db', getUserInfo],

    host: ['client', 'db', getHostInfo],
    build: ['client', 'db', getBuildInfo],
    cmdLineOpts: ['client', 'db', getCmdLineOpts],
    genuineMongoDB: ['build', 'cmdLineOpts', getGenuineMongoDB],

    listDatabases: ['client', 'db', 'userInfo', listDatabases],
    allowedDatabases: ['userInfo', getAllowedDatabases],
    databases: [
      'client',
      'db',
      'listDatabases',
      'allowedDatabases',
      getDatabases
    ],

    listCollections: ['client', 'db', 'databases', listCollections],
    allowedCollections: ['userInfo', getAllowedCollections],
    collections: [
      'client',
      'db',
      'listCollections',
      'allowedCollections',
      getCollections
    ],

    hierarchy: ['databases', 'collections', getHierarchy],

    stats: ['databases', getStats]
  };

  async.auto(tasks, function(err, results) {
    if (err) {
      // report error
      return done(err);
    }
    // cleanup
    results = omit(results, [
      'db',
      'listDatabases',
      'allowedDatabases',
      'userInfo',
      'listCollections',
      'allowedCollections',
      'cmdLineOpts'
    ]);
    return done(null, results);
  });
}
function getInstanceDetail(client, db, done) {
  const tasks = {
    client: attach.bind(null, client),
    db: attach.bind(null, db),
    userInfo: ['client', 'db', getUserInfo],

    host: ['client', 'db', getHostInfo],
    build: ['client', 'db', getBuildInfo],
    cmdLineOpts: ['client', 'db', getCmdLineOpts],
    genuineMongoDB: ['build', 'cmdLineOpts', getGenuineMongoDB],

    listDatabases: ['client', 'db', 'userInfo', listDatabases],
    allowedDatabases: ['userInfo', getAllowedDatabases],
    databases: [
      'client',
      'db',
      'listDatabases',
      'allowedDatabases',
      getDatabases
    ],

    listCollections: ['client', 'db', 'databases', listCollections],
    allowedCollections: ['userInfo', getAllowedCollections],
    collections: [
      'client',
      'db',
      'listCollections',
      'allowedCollections',
      getCollections
    ],

    hierarchy: ['databases', 'collections', getHierarchy],

    stats: ['databases', getStats]
  };

  async.auto(tasks, function(err, results) {
    if (err) {
      // report error
      return done(err);
    }
    // cleanup
    results = omit(results, [
      'db',
      'listDatabases',
      'allowedDatabases',
      'userInfo',
      'listCollections',
      'allowedCollections',
      'cmdLineOpts'
    ]);
    return done(null, results);
  });
}
function getInstanceDetail ( client , db , done ) { const tasks = { client : attach . bind ( null , client ) , db : attach . bind ( null , db ) , userInfo : [ 'client' , 'db' , getUserInfo ] , host : [ 'client' , 'db' , getHostInfo ] , build : [ 'client' , 'db' , getBuildInfo ] , cmdLineOpts : [ 'client' , 'db' , getCmdLineOpts ] , genuineMongoDB : [ 'build' , 'cmdLineOpts' , getGenuineMongoDB ] , listDatabases : [ 'client' , 'db' , 'userInfo' , listDatabases ] , allowedDatabases : [ 'userInfo' , getAllowedDatabases ] , databases : [ 'client' , 'db' , 'listDatabases' , 'allowedDatabases' , getDatabases ] , listCollections : [ 'client' , 'db' , 'databases' , listCollections ] , allowedCollections : [ 'userInfo' , getAllowedCollections ] , collections : [ 'client' , 'db' , 'listCollections' , 'allowedCollections' , getCollections ] , hierarchy : [ 'databases' , 'collections' , getHierarchy ] , stats : [ 'databases' , getStats ] } ; async . auto ( tasks , function ( err , results ) { if ( err ) { // report error return done ( err ) ; } // cleanup results = omit ( results , [ 'db' , 'listDatabases' , 'allowedDatabases' , 'userInfo' , 'listCollections' , 'allowedCollections' , 'cmdLineOpts' ] ) ; return done ( null , results ) ; } ) ; }
Retrieves many instance details, such as the build and host info,
databases and collections which the user has access to.

@param {MongoClient} client - The client.
@param {DB} db - database handle from the node driver
@param {Function} done - callback
Retrieves many instance details such as the build and host info databases and collections which the user has access to .