Hey, did everyone share?
And let's address our second and the final problem of this section.
And you might be wondering, hey, this you told us three problems.
The first one was hiding secret.
The second one was scalability or breaking up the code itself.
And the third one was database.
We don't need any packages for handling the scalability or the breaking of the files.
We can do it on our own.
So that's why it's not a big issue.
Hiding secret part is all done.
Now let's go ahead and talk about the database now for this entirety of the course, we are going to
choose the MongoDB as our database.
Now, here comes the big question that why MongoDB?
Why not MySQL?
Why not PostgreSQL or why not to choose some of the graph database or something else.
Now, this is where a lot of expertise come in and that is definitely out of the scope of this course.
But still, I'll give you some of the pointers that you can keep an eye on.
Now, recently, if you read some of the articles from the big tech giants recently what I studied from
the zero the which is India is one of the leading firm of or the brokerage firm.
So they wrote a very clearly in their article by their CTO that you can make an application as good
as possible.
But sometimes and most of the time the bottleneck actually comes from the database itself.
It's not like my SQL is bad or MongoDB is bad.
They both have their use cases and what you really want to do, what's the goal of your application?
So bringing out the fact that which one is best for application, that's where the expertise of the
experts or people who have worked years on, years on industry that comes in.
And that's why I get hired and so many companies to to make the consultancy about which is best for
their what the infrastructure infrastructure should look like, what tools to choose, what not to choose.
So definitely this is a little bit out of scope and that can we can have a great debate probably on
the Saturday Live or something on my YouTube channel right now, we have decided that we are going to
go with MongoDB.
This is one of the most industries in demand database right now.
But once you understand the core foundation of how to work with that, working in other databases is
almost equally kind of same process.
Yes, there are some expertise you have to gain there, but it's good there.
Now comes up the big question and a very, very big question, which is we are going to choose an ARM
or an ODM, the kind of a same they do the same work in the relational world.
We call them as Aurum.
In the world of databases which are similar to MongoDB, no sequels we call them as ODM.
Aurum stands for Object Relational Mapper in the ODM, we call it as object data mapper.
The goal is really simple.
They help us to perform some operations with the database.
It can be all the correct operation, like create some values inside the database, retrieve some value,
delete them, update them and all of that.
So the bigger question is why do we need an OAM?
Can we work directly with the MongoDB?
Why we are injecting something in between?
So let me just walk you through with that.
If I go into the documentation of MongoDB itself, this is the home page website of the MongoDB.
You can see there is a connect your application.
You can just go ahead and choose your driver.
So MongoDB yes, they provide you direct drivers that you can inject.
So I can just click up here and I can say that, hey, I want to use the Node.js drivers.
I can go ahead and select my application and they say that this is how you can do it and this is all
what we are having now.
Let's go ahead and go for a quick usage example.
Of course, there are examples for installation and everything.
We can do that.
But if you go up here that this is that, yeah, you can actually go ahead and use this.
Let me go back here and show you some of the more drivers up here.
So let's go ahead and say connect to MongoDB.
I want to connect it through it.
So these are the URL that will be given to you.
It can be local install or somewhere else.
And now all we have to do is say, hey, we are going to require the MongoDB, of course after installation
and then we can simply provide the URL.
I connect with that and connect with the MongoDB database instance itself and everything is given and
mentioned.
So if we can use the MongoDB drivers directly, why do we need to inject an item?
And a lot of time people who are pro backend developers make this argument that ORM can actually slow
your application.
You should directly talk to the database or use the driver itself.
Now I do some extent I agree with them, but onto a massive, massive application and I'm not talking
about 500,000 users or a million users.
I'm talking about 5 million users or 10 million users or some some scale of that request that, yes,
you want something where you can actually remove the bottleneck of the database itself.
Now the bigger question is should you be using an ottoman ODM?
Yes, my recommendation is absolutely 100%.
You should be using it.
I always give an example of can I run without the running shoes?
Yes, you can.
Is it going to help you?
Yes.
Running shoes helps you.
Same goes for basketball.
Can I play basketball without having good shoes?
Yes, you can.
You will still be able to shoot all the three pointers, but in case you have good shoes, it actually
helps you a little bit in the initial days.
Same goes for the Aurum and ODM that yes.
In the initial days they help you a lot.
In fact, you'll be able to write your code much faster, easier and in.
Near Manor and the tons of tons of people use that is the industry standard coming back.
What kind of OEM or ODM we are going to choose?
We are going to choose Mongoose, which is one of the industry standard and everybody uses that.
Is it the only one?
No, not at all.
If you'll search for IRM or ODM for MongoDB, you'll find so many of them and every single month new
ones are popping around.
But still, this is the industry leader and it is probably going to stay there for a long while.
So we're going to study more about that.
And in the next video we are going to see that how we can take advantage of the mongoose, just like
we have studied in depth about the express we are going to do same for Mongoose.
So we are going to learn how we can use validation, casting, what even that is how we can write the
business logics and boilerplate and all of that, and how we can do all of this.
So I think that gives you a pretty clear understanding of what we are doing, why we are doing, and
what's the reason behind that.
So let's go ahead.
And in the next video, let's talk about Mongoose.