0 votes
in MongoDB by
How to create database in mongodb. Please specify the steps as well as screen short

1 Answer

0 votes

Open your mongo console and type the following command:
use testDB (testDB is database name)

> use testDB
switched to db testDB

But, when you will see to created database in mongodb to use following command:
show dbs

> show dbs
local    (empty)

Again, you see only one database exists. Means you save something in this database then you will able to see database. With the help of following command you save something in your database:

> db.user.save({firstName:"Ram", lastname:"Kumar"})

After that run the following command on command prompt:
show dbs

> show dbs;
local    (empty)
testDB    0.203125GB

Share:- Whatsapp Facebook Facebook

Welcome to Developerhelpway Q&A, where you can ask questions and receive answers from other members of the community.