MongoDB Create Collection
MongoDB stores documents in collections. The collections are analogous to tables in relational databases like MySQL. Generally, you don’t need to create a collection, MongoDB does this automatically during the insertion of the first document.
Syntax
Use db.createCollection() command to create collection. You need to specify the name of the collection, Also can provide some optional options like memory size and indexing.
MongoDB – Create Collection
Login to Mongo shell and select your database with the following command.
Now create your collection with createCollection() command. The below command will create a collection named mycol in the current database.
0 Comments
CAN FEEDBACK
Emoji