docs: function(params, callback) {
    var CONST_CONN_STRING = "connectionString";
    if (!params.act) {
      throw new Error("'act' undefined in params. See documentation of $fh.db for proper usage");
    }
    // Type required for all but list operations, where we can list collections by omitting the type param
    if (!(params.type) && ['close', 'list', 'export', 'import', CONST_CONN_STRING].indexOf(params.act) === -1) {
      throw new Error("'type' undefined in params. See documentation of $fh.db for proper usage");
    }
    if (!appname) {
      throw new Error("Internal error - no appId defined");
    }
  
    if (CONST_CONN_STRING === params.act) {
      return getMongoConnectionUrl(callback);
    }
    params.__fhdb = appname;
  
    //If there is a mongo connection url, then the one-db-per-app parameter must be set for the request
    //to alert ditcher the app has its own database.
    async.waterfall([
      getMongoConnectionUrl,
      function cacheConnectionString(connectionString, callback) {
        //cache the connection string for the lifetime of this process
        if ('string' === typeof connectionString) {
          process.env.FH_MONGODB_CONN_URL = connectionString;
        } else if ('function' === typeof connectionString) {
          callback = connectionString;
        }
        return callback();
      }
    ], function processMongoAction(err) {
      if (err) {
        return callback(err);
      }
      if (process.env.FH_MONGODB_CONN_URL) {
        params.__dbperapp = appname;
      }
  
      var fhdb = require('fh-db');
      if (process.env.FH_MONGODB_CONN_URL) {
        return fhdb.local_db(params, callback);
      } else {
        //net_db should not be called by apps created using fh-webapp --
        if (process.env.FH_DB_PERAPP) {
          debug('attempt to use db per app with no data storage enabled');
          return callback(new Error("Data storage not enabled for this app. Please use the Data Browser window to enable data storage."));
        } else {
          debug('using net_db (DITCH)');
          return net_db(params, callback);
        }
      }
    });
  }