Comparing MongoDB vs SQL Concepts

Many of the components that go into the MongoDB data structure have their counterparts in relational database management systems based on the Structured Query Language (SQL).

The following table describes the MongoDB data objects and shows how they map to SQL data objects.

If you have a background in relational databases, you can use this MongoDB vs SQL data object comparison as a quick reference to better understand the MongoDB data structure as you work through the lesson.

MongoDB objectDescriptionSQL object
databaseA container for holding document collections. A MongoDB instance can support multiple databases. Each database is associated with its own set of files. MongoDB creates these files when you add the first collection. The database does not physically exist until you add that collection.database
collectionA grouping of documents in a common namespace. Unlike an SQL table, documents within the same collection can have different structures, resulting in more flexibility than you get with an SQL database.table
documentBasic unit of data in a MongoDB database. MongoDB leverages the Extended JSON format to store and work with documents. In the background, MongoDB uses BSON (binary plus JSON) to represent the documents. BSON is a binary-encoded format that extends the JSON model to provide additional data types and other capabilities.row (or record)
fieldA name-value pair in which the value conforms to a BSON data type. MongoDB automatically assigns data types to the field values when you add a document to a collection. You can override this behavior by using a constructor in the document definition to specify a data type.column
data typeA data attribute that enforces the type of data that can be used in a field. Each field is assigned a data type
primary keyA required value that uniquely identifies a document within a collection. The primary key is always implemented as the _id field.

Terms you might not know:

namespace: name for a collection or index in MongoDB. The namespace is a combination of the database name and the name of the collection or index (source)

name-value pair: a common way of giving data meaning, whereby one half of the pair holds the data and the other half of the pair holds an attribute that describes the data. One common example might be an attribute, or name of “First Name” and the data, or value of “Thomas” (source)

Log in

Log in to your Studio 3T Academy account

Forgot password?

Don't have an account yet? Sign up
Sign up

Start learning MongoDB today. All fields are mandatory.

By signing up for a course, you agree to the 3T Software Labs Privacy Policy.

Already have an account? Log in