mongosh Create Collection
Create Collection using
There are 2 ways to create a collection.
You can create a collection using the
createCollection() database method.
You can also create a collection during the
We are here assuming
This will create the "posts" collection if it does not already exist.
Remember: In MongoDB, a collection is not actually created until it gets content!