MongoDB – Commands

Create Database

> use <Database_Name>

> use documents

createdb

Check current database

> db

listdb

List databases

> show dbs

listdbs

To display a database has atleast one document into it.

Insert a document in database

> db.cv.insert({“name”:”vikas”,”address”:”delhi”})

insertadoc

List databases

> show dbs

showdbs

MongoDB provides one default database – test

Drop database

> db.dropDatabase()

Above command will delete selected database.

dropdatabase

Database has been deleted

deletedb

MongoDB – Introduction

Vikas Jindal

Advertisements

One thought on “MongoDB – Commands

  1. Pingback: MongoDB – Introduction | vikkasjindal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s