liquido.mongoDB.js
/**
 * DELETE all collections in the current DB.   BE CAREFULL!!!
 */
DELETE all collections in the current DB.   BE CAREFULL
DELETE all collections in the current DB . BE CAREFULL
async function purgeDB() {
	return mongoose.connection.db.listCollections().toArray().then(collections => {
		if (!collections) return Promise.resolve("Nothing to remove")
		let tasks = collections.map(col => {
			LOG.debug("DROPPING collection:", col.name)
			return mongoose.connection.db.dropCollection(col.name)
		})
		return Promise.all(tasks)
	})
}
async function purgeDB ( ) { return mongoose . connection . db . listCollections ( ) . toArray ( ) . then ( collections => { if ( ! collections ) return Promise . resolve ( "Nothing to remove" ) let tasks = collections . map ( col => { LOG . debug ( "DROPPING collection:" , col . name ) return mongoose . connection . db . dropCollection ( col . name ) } ) return Promise . all ( tasks ) } ) }
DELETE all collections in the current DB.
DELETE all collections in the current DB .
/*
	await mongoose.connection.db.dropDatabase(function (err, result) {
		console.log("DROPPPED database!")
	});
	*/