Mongodb Create Database - MongoDB Tutorial

Mongodb Create Database

  • MongoDB is a document-oriented DBMS, with JSON-like objects comprising the data model like field and value pairs, rather than RDBMS tables.
  • Documents are analogous to structures in programming languages that associate keys with values (e.g. dictionaries, hashes, maps, and associative arrays).
  • Formally, MongoDB documents are BSON documents.
  • BSON is a binary representation of JSON with additional type information.
  • In the documents, the value of a field can be any of the BSON data types, like
    • Documents
    • Arrays, and arrays of documents.

Features of mongoDB :

  • MongoDB does not support joins nor transactions.
  • The secondary indexes, an expressive query language, atomic writes on a per-document level, and fully-consistent reads.
  • MongoDB uses BSON, a binary object format similar to, but more expressive than JSON.

Syntax (Show database) :

Db    --used for display the database
  • Default database in mongoDB is “test”. If you want to create a new database use the “use” operation.

Syntax (create database) :

Use <database>
  • In this syntax the <database> is replaced by the name of the data base.

Syntax (Show database) :

show dbs
  • It is used to Print the list of all databases on the server.

Syntax (Insert database) :

  • In MongoDB, using Insert query we can add/insert new document into the database.

Sample Query

use  wikitechy    --create database
db                --display the created database
show dbs          --display the database
db.wikitechy.insert({"websitename":""})  --insert datas
show dbs          --display the database	


  1. Here in this statement initially we set the path of the data storage.
  2. Here we create a new database “wikitechy”.
  3. In this statement we display the created database.
  4. Here in this statement we insert a data “websitename” : “” to the database using insert query.
  5. In this statement we display the database.

Related Searches to Mongodb Create Database - MongoDB Tutorial