MongoDB Explained in 10 Minutes | SQL vs NoSQL | Jumpstart

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
sql nosql relational non-relational table collection row document column field what does it all mean [Music] stick around in this short video i'm going to explain it all and hopefully help you decide which database to learn and use in your next project hi i'm jesse i'm a senior developer advocate at mongodb let me introduce you to the mongodb jumpstart series the objective of this series is to get you started with mongodb atlas and its entire ecosystem each part of atlas will have its own dedicated video to help you get up and running with each feature throughout this series we're going to build an ecommerce website that will use mongodb atlas and all of its features if you want to see the project built from the beginning to the end then you should watch the series in order from the playlist but if you're already familiar with atlas and you just want to learn about a specific feature feel free to skip to the video that interests you the links are in the description below so what is mongodb well first you need to understand how sql and nosql databases work these are also referred to as relational or non-relational so let's talk about the og database sql stands for structured query language it's a relational database the easiest way to understand how sql data is structured is by comparing it to an excel spreadsheet in relational databases like sql data is stored in rows and columns each row is a record and each column is a record field in this example we're storing user data we have an id first name last name email address physical address and phone number it seems pretty straightforward but what happens when we want to add another email address to this user we'll have to add another column called email two then if for some reason there's a third email address then we'll need to add a column called email three now let's add another record this one only has one email address so the second and third columns are going to be blank we'll have the same issues with adding multiple physical addresses and phone numbers then let's add some more records you can see how this is getting out of control quickly the database is getting bloated with these empty fields now because of this relational databases separate related data into their own tables we can extract the email address physical address and phone number columns and put them in their own table which is tied back to the original table record with an id this is where the term relational comes from the data in these tables are related so now we have multiple tables relating back to the original table of records if we want to get the information for one record we now have to access multiple tables and join the data back together then there's schemas schemas define how the structure or blueprint of how our data should look schemas in sql are strict meaning that the data field types must be defined ahead of time adding additional columns or fields to tables affects all of the rows and records in that table and can result in bloated tables and failed queries if they're not updated properly when it comes to scaling most sql databases only scale up vertically and those that can scale horizontally are difficult to configure this means that you have to upgrade to larger more expensive servers as your database grows so why do things have to be so complex let's go back in time sql databases have been around since the 1970s and we're mainly focused on reducing data duplication since disk storage was very expensive back then here's a picture of an ibm 5 megabyte hard drive this is the main reason why it's structured in a tabular format because of all of this sql is difficult to understand structurally it's hard to make changes to the data structure because of the rigid schemas it's inefficient because of multiple tables being queried and it's more expensive due to the vertical scaling so now let's take a look at nosql or non-relational databases most refer to nosql as meaning not sql but it can also be referred to as not only sql in any case the point is that nosql databases are structured differently than sql databases then there's relational versus non-relational terminology generally nosql databases are referred to as non-relational because they don't store data in related tables like sql does a big misconception is that non-relational databases cannot store relational data relational data can be stored in nosql databases it's just stored differently there are several types of nosql databases there are key value databases wide column stores graph databases and document databases mongodb is a document database instead of using tables rows and columns document databases store data in documents specifically json javascript object notation structured documents if you're familiar with javascript objects then you're going to be right at home with nosql data structures json is structured as objects containing key value pairs we define an object with curly braces then our key is surrounded by quotes and lastly our value is separated from the key by a colon the value can be a string surrounded by quotes a number without quotes arrays of values using square brackets or even another object from our previous example of user data we now have a user record formatted as json data we have our underscore id first name last name email address and phone number when we have multiple values we can just use an array to define them so for the email value we can define that as an array of email addresses then we can do the same for the addresses and phone numbers so we see here that a single document stores all the data for each record instead of splitting up the data generally data that is accessed together stays together although the documents that you work with are in json format mongodb actually stores the data on the server in bson format bson is an extension of json and adds support for expanded data types now the schemas within mongodb are very flexible by default there are no rules in place you can store any type of data in any document this is by design if you want more structure it can be added at any time and the scaling in mongodb is very cost effective instead of vertical scaling only nosql databases generally scale horizontally that means that instead of going up to a more expensive server you can utilize multiple cheaper servers at a fraction of the cost because of the structure this type of database is very efficient easy to understand and easy to modify and update let's take a look at some terminology differences between sql and nosql so in sql a cluster is a cluster in nosql and in sql we have a database also in nosql we have a database but here's where the differences come in in sql we have tables but in nosql we have collections in sql we have rows but in nosql we have documents and sql a column is in nosql a field now let's take a look at the mongodb ecosystem we're going to get a high level overview of each part so first we have self hosted this option will allow you to host your own mongodb server on your hardware this requires that you manage your server updates and any other maintenance you can download and use the mongodb open source community server on your hardware for free next we have atlas so if you don't want to go the old school route of managing all of this on your own you need mongodb atlas atlas utilizes a software as a service approach and is a global cloud database as a service for modern applications with it you can deploy a fully managed mongodb server across aws google cloud and azure with best-in-class automation and proven practices that guarantee availability scalability and compliance with all of the most demanding data security and privacy standards compass is the gui for mongodb it's available on linux mac or windows it allows you to visually explore your data run ad hoc queries in seconds interact with your data with full crud functionality view and optimize your query performance and make smaller decisions about indexing document validation and much more with mongodb realm you can build better apps faster with edge to cloud sync and fully managed back-end services including triggers functions and graphql mongodb realm sync handles conflict resolution and networking code for you so you can build better mobile apps faster mongodb atlas search makes it easy to build fast relevant full-text search capabilities on top of your data in the cloud available exclusively with mongodb atlas with search you'll get a leucine-powered search engine typo tolerance with fuzzy searching autocomplete filters and facets custom scoring and much more mongodb charts is a modern data visualization tool that is integrated with the mongodb cloud data platform charts is the quickest easiest and most powerful way to visualize mongodb data or real-time insights business intelligence and embedded analytics with atlas online archive you can tier your data across fully managed databases and cloud object storage and query it through a single endpoint automatically archive historical data and save on operational and transactional data storage costs without compromising on query performance with mongodb atlas data lake you can query and analyze data across aws s3 and mongodb atlas in place in its native format csv files and other formats using the mongodb query language save money by storing your historical data on aws s3 and then combine and analyze live and historic data without data movement or operational overhead and pay only for the queries you run now that you understand the basics of how mongodb works let's learn more about atlas the fully managed cloud database be sure to sign up for a free account at mongodb.com in the next video we'll create our first atlas cluster and load some sample data if this video was helpful be sure to like and subscribe i'll see you in the next one [Music] [Music] you
Info
Channel: MongoDB
Views: 76,446
Rating: undefined out of 5
Keywords: MongoDB
Id: RGfFpQF0NpE
Channel Id: undefined
Length: 11min 17sec (677 seconds)
Published: Tue Jul 27 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.