Mongodb Classroom image

Anil  Bist / Professional / DataBase

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

Both the  db.collection.insert()  and the  db.collection.createIndex()  operations create their respective collection if they do not already exist.

>  db. newCollection2.insert  ( { name : "XXX" } )
>  db. newCollection3.createIndex  ( { accountNo : 1 } )

 

Now, Show All the collections using show collections command

> show collections
newCollection1
newCollection2
newCollection3
newCollection4
system.indexes

 

If you want to se the inserted document, use the  find()  command.

> db. newCollection2.find()
{  "_id" : ObjectId ( "58f26876cabafaeb509e9c1f" ), "name" : "XXX" }
 
 
 
image
Anil  Bist

Skills    Mongodb

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

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)