WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

MongoDB - Create Database


MongoDB - Create Database : In this chapter the way to create a database in MongoDB.

The use Command

MongoDB use DATABASE_NAME is used to create database. The command will create a brand new database if it does not exist,

Syntax

There are following Basic syntax of use DATABASE announcement is as follows −
use DATABASE_NAME

Example

If you need to use a database with name <mydb>, then use DATABASE announcement would be as follows −

>use mydb
switched to db mydb
To test your currently selected database, use the command db
>db
mydb
If you want to test your databases list, use the command show dbs.
>show dbs
local     zero.78125GB
take a look at      zero.23012GB
Your created database (mydb) is not present in listing. To show database, you need to insert as a minimum one report into it.
>db.movie.insert("call":"Welookups")
>display dbs
nearby      zero.78125GB
mydb       zero.23012GB
check       zero.23012GB




Welookups is optimized for learning.Copy right 2018 kumar aditya singh .
All Right Reserved and you agree to have read and accepted our term and condition.
All Rights Reserved.