Oct 12, 2019 in Big Data | Hadoop
Q: How to Create or select a database in MongoDB?

1 Answer

0 votes
Oct 12, 2019

MongoDB use DATABASE_NAME is used to create database. The command will create a new database if it doesn't exist, otherwise it will return the existing database.

Syntax

Basic syntax of use DATABASE statement is as follows −

use DATABASE_NAME

Select a database :

If you want to use a database with name <myMangoDB>, then use DATABASE statement would be as follows −

>use myMangoDB
switched to db myMangoDB

To check your currently selected database, use the command db

>db
myMangoDB

Related questions

0 votes
Oct 12, 2019 in Big Data | Hadoop
0 votes
Oct 12, 2019 in Big Data | Hadoop
...