0 votes
1 view
in Web Technology by (43.2k points)

I could not find a way to drop the database with Mongoose as I'm preparing a database creation script in Node.js and Mongoose.

1 Answer

0 votes
by (92.8k points)
edited by

For removing the content refer the following syntax :

Model.remove({}, function(err) { 

   console.log('collection has been removed') 


But before removing the content, you have to access the mongodb native javascript driver, refer the following process for accessing the javascript driver:

mongoose.connection.collections['collectionName'].drop( function(err) {

    console.log('collection dropped');


Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !