function deleteCloudantDatabases(name){
    name = name.toLowerCase();

    var toDelete = [
        "_images", "_audio", "_sensorlog", "_eventlog", "_positionlog"
    ];

    for(var i=0; i<toDelete.length; i++){
        (function(databaseName){
            cloudant.db.destroy(databaseName, function(err){
                if(err){
                    logger.error("Couldn't delete database "+ databaseName + " for drone " + name);
                    logger.error(err.message);
                } else {
                    logger.info("Deleted database "+ databaseName + " for drone " + name);
                }
            })
        })(name + toDelete[i]);

    }
}
/**
 * Delete Cloudant databases for given droneName
 * @param name {String} Provided drone name
 */
Delete Cloudant databases for given droneName
@param name {String} Provided drone name
Delete Cloudant databases for given droneName @param name { String } Provided drone name
function deleteCloudantDatabases(name){
    name = name.toLowerCase();
    var toDelete = [
        "_images", "_audio", "_sensorlog", "_eventlog", "_positionlog"
    ];
    for(var i=0; i<toDelete.length; i++){
        (function(databaseName){
            cloudant.db.destroy(databaseName, function(err){
                if(err){
                    logger.error("Couldn't delete database "+ databaseName + " for drone " + name);
                    logger.error(err.message);
                } else {
                    logger.info("Deleted database "+ databaseName + " for drone " + name);
                }
            })
        })(name + toDelete[i]);
    }
}
function deleteCloudantDatabases ( name ) { name = name . toLowerCase ( ) ; var toDelete = [ "_images" , "_audio" , "_sensorlog" , "_eventlog" , "_positionlog" ] ; for ( var i = 0 ; i < toDelete . length ; i ++ ) { ( function ( databaseName ) { cloudant . db . destroy ( databaseName , function ( err ) { if ( err ) { logger . error ( "Couldn't delete database " + databaseName + " for drone " + name ) ; logger . error ( err . message ) ; } else { logger . info ( "Deleted database " + databaseName + " for drone " + name ) ; } } ) } ) ( name + toDelete [ i ] ) ; } }
Delete Cloudant databases for given droneName
 @param name {String} Provided drone name
Delete Cloudant databases for given droneName @param name { String } Provided drone name