SQL to MongoDB Mapping

Terminology and Concepts

SQL Terms/ConceptsMongoDB Terms/Concepts
databasedatabase
tablecollection
rowdocument or BSON document
columnfield
indexindex
table joins$lookup, embedded documents
primary keySpecify any unique column or column combination as primary key.primary keyIn MongoDB, the primary key is automatically set to the _id field.
aggregation (e.g. group by)aggregation pipelineSee the SQL to Aggregation Mapping Chart.
SELECT INTO NEW_TABLE$outSee the SQL to Aggregation Mapping Chart.
MERGE INTO TABLE$merge (Available starting in MongoDB 4.2)See the SQL to Aggregation Mapping Chart.
UNION ALL$unionWith (Available starting in MongoDB 4.4)
transactionstransactions

Executables

MongoDB MySQL Oracle Informix DB2

Database Server mongod  mysqld oracle IDS DB2 Server

Database Client mongo  mysql sqlplus DB-Access DB2 Client

Create, Alter and Drop

Insert

Select

Update Records

Delete Records

MongoDB Collection

You can create a collection (Table) using the command line or GUI.

Here we hit the first error.

As you can see in the above error. You can’t create under the ‘admin’.

You can insert the data into collection (table) from json or csv etc.

Never to miss some important points here.

If you note it carefully from the below screenshot, you will notice that a collection(table) can be export (as you can see the arrow below 1. marked red) and even can import file or document. As already said you can import the data from csv or JSON too.

Below screenshot reminded me about the MySQL database. That also got the same options.