In this chapter, we will explain how to create a database in MongoDB.
MongoDB use DATABASE_NAME is used for creating a database. This command will create a new database if it doesn't exist, else it will return the existing database.
Basic syntax of use DATABASE statement is as follows
For creating a database with name <mydb>, then use DATABASE statement would be as follows
To check current database, use the command db
To check the databases list, use the command show dbs.
Created database (mydb) will not be present in list. To display the database, at least one document should be inserted into it.
Default database in MongoDB is test. If you are not creating any database, then collections will be stored in test database.
MongoDB Related Interview Questions
|Python Interview Questions||C & Data Structures Interview Questions|
|Hadoop Interview Questions||Node.js Interview Questions|
|Scala Interview Questions||Socket Programming Interview Questions|
|HBase Interview Questions||Solaris Administrator Interview Questions|
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.