>show dbs    It will show the default Database.

Write this Statements

>a = { title:"Arrested Development", airdate:"November 2, 2003", network:"FOX" }
> b = { title:"Stella", airdate:"June 28, 2005", network:"Comedy Central" }
> c = { title:"Modern Family", airdate:"September 23, 2009", network:"ABC" }
db.<yourdatabase name>.save( varialbe ) : This command save the data.
>db.shows.save(a)
> db.shows.save(b)
> db.shows.save(c)
db.<yourdatabase name>.find() : Show your database content.
 >db.stats()
To get stats about mongodb server type the command db.stats() in mongodb client. This will show the database name, number of collection and documents in the database. 
>db :To check current database
>use <database name> : To take as your current database
>db.<yourdatabasename>.save( { “name”:”androidtour.wordpress.com” }  )
>db.<yourtablename>.insert( { “name”:”androidtour” } )
You can also Write direct:
>db.test.save( { a: 1 } )
>db.test.find()
Advertisements