Remove in mongo DB

remove Command will remove all the documents from the collection or only specified documents that matches the input values.

To remove specified Documents we should pass the input as below.

db.studentDetails.remove({Department:'EEE'})

The above command will removes the Documents with Department as EEE

To remove all the documents from the collection Documents we should pass the empty parenthesis to the remove condition.

db.studentDetails.remove({})


Note: Better to use drop than remove to delete all the documents from the collection. Drop will give better performance than remove.