Now, the last missing piece of course,
is how we can delete documents.
And that's all rather straightforward.
Let's say we want to delete this second document.
For this, we can execute DB, then of course
the collection name that holds the document
that should be deleted.
And then there, we got the delete one or delete many
methods that we can execute
and the commands do what their names suggest.
Delete one will delete the first matching document,
even if your condition would match multiple documents.
Delete many will delete all matching documents.
Here I only want to delete one,
and then you pass in one parameter value where you again
have the same filtering syntax as you saw before.
For example, looking for an ID
where we actually are looking for this ID now,
this time for real, so I'll just insert this between quotes
inside of object ID, and hit enter.
Again, we get a confirmation where we also
see how many documents were deleted.
And now with that, if I then find all my restaurants
thereafter, there is only one document left
in there because I deleted the other one.
And that's how we can perform those crowd operations
on MongoDB or with MongoDB
with this MongoDB query language,
which as you can tell is quite different compared to SQL,
but which hopefully still makes a lot of sense
and is easy to get into.
And you here also see the difference between tables
and collections and having a fixed structure,
a clearly defined structure
and having no clearly defined structure.
With MongoDB, the collections are created on the fly
once we start inserting data,
and we can add different documents,
even though we didn't do that here,
into the same collection if you wanted to.
So, therefore these are the basics.
Now, before we explore how we can use MongoDB with node
and express in the next course section,
let's first of all go back to that restaurants
reviews example and see how we would complete this
in the MongoDB world and how we would
structure our data there.