nl_tokens: Async function to add stats to each db .
pl_tokens: function addStats ( database , cb ) { // If a databaseName is present, it's a single db.  No need to switch. var changeDB = database . databaseName ? <mask> : db . db ( database . name ) ; // Get the stats changeDB . stats ( function ( err , stats ) { // Remove 1 from collection count, unless it's zero. Not sure why it's 1 off. if ( stats . collections ) { stats . collections -- ; } // Add the db name as the _id stats . _id = stats . db ; stats . name = stats . db ; // Rename collections to avoid collisions on the client app. stats . collectionCount = stats . collections ; delete stats . collections ; // Add the stats to the corresponding database. dbList . push ( stats ) ; cb ( null , database ) ; } ) ; }