Since MongoDB falls under the category of unstructured databases, the terminology used widely differs from its structured counterparts, such as MySQL and PostgreSQL. The following table presents various SQL terminology and concepts and the corresponding MongoDB terminology and concepts:
SQL terms/concepts |
MongoDB terms/concepts |
database |
Database (https://docs.mongodb.com/manual/reference/glossary/#term-database) |
table |
Collection (https://docs.mongodb.com/manual/reference/glossary/#term-collection) |
row |
Document or BSON document |
column |
Field (https://docs.mongodb.com/manual/reference/glossary/#term-field) |
index |
Index (https://docs.mongodb.com/manual/reference/glossary/#term-index) |
table joins |
$lookup, embedded documents (https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/#pipe._S_lookup) |
primary key |
Primary key (https://docs.mongodb.com/manual/reference/glossary/#term-primary-key) |
Specify any unique column or column combination as primary key. |
In MongoDB, the primary key is automatically set to the _id field. (https://docs.mongodb.com/manual/reference/glossary/#term-id) |
aggregation (example group by) |
Aggregation pipeline |
transactions |
Transactions (https://docs.mongodb.com/manual/core/transactions/) |