Mongo DB Shell Command – Create Database


  1. Connect to shell by running mongo
  2. To create a database, enter “Use <database_name>”  command in the shell. (The command will create a new database, if it doesn’t exist, otherwise it will return the existing database)
  3. You need to insert at least one document to make it display in the db list command. Enter “db.<document_name>.insert({name:”test”})” command to create the first document.

Ref:

http://www.tutorialspoint.com/mongodb/mongodb_create_database.htm

Advertisements

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s