In this video.
Let's talk about types of database relationship, which means that how we can relate to or more documents
together.
But before we get into that, let's go over what we call the planning stage.
So as we discussed in the previous video, let's go over again because it's really important.
Now, let's say that you got the idea about the entire application.
So after you go the idea, the first step is what you name your database as we said.
So in this case, let's say you are building a blog application.
So here the name of a database is called What Blog Application?
And for the blog application you may need a different collection.
For example, you're going to have post collection and call this one as collection one.
You need collection to core users and you need another collection called Comments.
Now you can see that these collections are independent.
They don't know each other.
And let's say that if you want to know which post was made by a certain user and what comments was made
by a user and what post has a specific comment.
And this is what we call database relationship.
So with that being said, let's have a look at types of database relationship.
The first type of database relationship is what you call 1 to 1 relationship.
What does it mean?
Let's take it that we are building a blog application and we have three collections posts, users and
comment.
When we say 1 to 1, it simply means that one user can have one post or can create a post and a post
belongs to a user, meaning one is to one, and for this kind of relationship is not mostly used.
The next type of relationship is what you call one to many relationship.
Again, let's take a block application into this context.
It simply means that one user can have or create many posts, but a post belongs to a single user.
That is it.
And this kind of relationship is mostly used 100% in any application.
I can tell you that there is at least one to many relationship, and the next type of relationship is
what we call many to many relationships.
Well, what does it mean?
It simply means that one user can have many posts, but a post belongs to many users.
Again, this kind of relationship is not mostly used and we use this kind of relationship mostly in
e commerce application.
We can have a product having many orders and the same orders can have many users.
So let's say that we have a product called iPhone, that iPhone many users can order that particular
product, meaning that that particular product can have many orders and that orders belongs to that
particular product.
And again, this kind of relationship is not that mostly used, but the one which is really important
is what we call one to many relationship.
And this is what I'm going to show you if I show you this one.
Implementing these ones are easy.
But like I said, you are going to work with what is called one to many relationships.
All right.
The next video, I will show you how we can relate document together.
So we are in the process of what modeling data now we know ties of relationship.
Now let's go ahead and talk about how we can relate to or more document together in the next video.