Mongodb Classroom image

Anil  Bist / Professional / DataBase

To post your Question Join Classroom
Lesson Topics's No:-  |1 | 2|Last
Lessons:-Create a Collection


Create a Collection

First Select Or Create a database.

> use mydb
switched to db mydb


Using  db.createCollection ( "yourCollectionName" method you can explicitly create Collection.

>  db. createCollection ( "newCollection1" )
"ok" : 1


Using  show collections  command see all collections in the database.

>  show  collections
system. indexes


The  db.createCollection()  method has the following parameters:

Parameter         Type              Description
name                string               The name of the collection to create.
options              document         Optional. Configuration options for creating a  capped collection  or for preallocating space in a new collection.


The fllowing example shows the syntax of  createCollection()  method with few important options

>db. createCollection ( "newCollection4", {capped : true, autoIndexId : true,  size  :  6142800,  max :
10000 })
{ "ok"  : 1  }


Anil  Bist

Skills    Mongodb

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India

in 2006, i Join a web development company in Bangalore and start work on "Ruby on Rail" this is my first web development framework and we worked in this framework and develop four to five project after some time , I moved to JEE/Sturst frame work,

After some time i decided that now times come and I have to go on in my own way and I started a company name is "Soarlogic&q


  Students (0)