91-9990449935 0120-4256464 |
MongoDB Create CollectionIn MongoDB, db.createCollection(name, options) is used to create collection. But usually you don?t need to create collection. MongoDB creates collection automatically when you insert some documents. It will be explained later. First see how to create collection: Syntax: Here, Name: is a string type, specifies the name of the collection to be created. Options: is a document type, specifies the memory size and indexing of the collection. It is an optional parameter. Following is the list of options that can be used.
Let's take an example to create collection. In this example, we are going to create a collection name SSSIT. switched to db test { "ok" : 1 } To check the created collection, use the command "show collections". SSSIT How does MongoDB create collection automaticallyMongoDB creates collections automatically when you insert some documents. For example: SSSIT seomount
Next TopicMongoDB Drop Collection
|