[00:00] Deleting documents in a Mongo collection is pretty straightforward. So there is delete one, delete many, deleting at most one mesh document, deleting many. And we're going to pass only what is the query that would identify certain documents. So before we delete the documents, let's also take a look at what we've got right now. So db employees, so let's find, let's query all of them.
[00:27] Now we want to display only some of the fields so that we are not overwhelmed with all the information so we're just going to display the name and salary we can also remove the object ID as we've done before so that would be zero now let's get back to deleting so delete one let's delete somebody who is going to have the salary that is going to be nine thousand and a half. So that would be salary over here. So acknowledge true, delete count 1 which is pretty obvious let's also rerun our find so that we can see that Ada Lovelace is removed from the collection. So now let's also run the count documents instead of the find. So we have 12 documents as for now.
[01:23] And let's also run the delete many. So we're going to delete all the documents that have salary, which is going to be, for instance, greater than 8000. So again, we need to make it a nest document so which is going to be or greater than or equal so there were six documents that needed to be removed so let's also take a look We've got six documents that are left. So let's also see how do they look like at this point. So that would be this one.
[01:56] And if we pass the delete many, which is going to include an empty query, That basically means that all of them are going to be matched. So this is essentially clearing a whole collection. So acknowledge true, delete count. Now how many documents we have left? This is none.