Mongo DB Shell Command – Create Database

  1. Connect to shell by running mongo
  2. To create a database, enter “Use <database_name>” ¬†command in the shell. (The command will create a new database, if it doesn’t exist, otherwise it will return the existing database)
  3. You need to insert at least one document to make it display in the db list command.¬†Enter “db.<document_name>.insert({name:”test”})” command to create the first document.