MongoDB - Create Collections

Professionaluser
Posted by Professionaluser under Sql Server category on | Points: 40 | Views : 1194
MongoDB stores the data in the form of documents in a collection. ( it is similar to records in a table for our understanding only)

To create a collection in MongoDB,

>db.createCollection("TestCollectionName") 


Each collection has the following properties which are optional,
capped -- It is of Boolean data type and capped collectiona is a fixed size collecction that automatically overwrites its oldest entries when it reaches its maximum size.
autoIndexID -- Boolean type option and creates an index on the ID field
size -- Number type, specifies a maximum size in bytes for a capped collection
max -- specifies a maximum number of documents in the capped collection

Comments or Responses

Login to post response