show dbs = is use to show the all database present in Database.
use shubhamdb = if already present then this will switched to shubhamdb database otherwise this will make a new Database name shubhamdb.
Now Need to add some collections (SQL in Tables) in this mongoDb Database. so we use below command.
Create a New Database and Collection
To create a new database, issue the use <db>
command with the database that you would like to create. For example, the following commands create both the database myNewDatabase
and the collection myCollection
using the insertOne()
operation:
If a collection does not exist, MongoDB creates the collection when you first store data for that collection.
myCollection is Collection name (in SQL table Name) insertOne() to inset the collection
BSON stands for Binary Javascript Object Notation. It is a binary-encoded serialization of JSON documents. BSON has been extended to add some optional non-JSON-native data types, like dates and binary data.