in Big Data | Hadoop by
Q:
How to Create or select a database in MongoDB?

► Click here to show 1 Answer

0 votes
by

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
Loan/Mortgage
Learn More with Madanswer

Related questions

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