And the last section we finished wiring up longers to our express API.
Now before we just dive in face first and start writing some code and Mongoose I want to take a very
quick pause.
We spent the last 30 minutes or so talking about some very detailed and very complex topics around authentication
inside of our application.
Now at this point you might be sitting there thinking like Steven what are we using mongoose for.
Why are we finishing up the passport's stuff like where are we what are we trying to do here.
And so I wanted to just take a break and make sure that we are really on the same page about what we
are trying to accomplish right now and how we are going to accomplish it.
OK.
So let's get to this.
We just finished provisioning a remote instance of Mongo and then we hooked it up to our application
by using the mongoose library.
The reason that we brought in the idea of a database at all into our application is to satisfy one very
basic need inside of our authentication process.
We need the ability to identify users who initially sign up for application sign out and then come back
at some point in the future and sign in again every single time that a user signs up initially for our
application.
We're going to take that I.D. property out of their google profile and create a new record inside of
our Mongo database that saves that I.D. We will then be able to save surveys or posts or e-mails or
any other type of data we have in our application and pointed to that user record and say OK this user
owns this survey and this post and whatever else.
Now to make that actually happen we're going to use mongoose to create a new collection of records in
Mago which we're going to refer to as our users collection.
So that's why we installed mongoose.
We're going to use it to create this new collection.
Now we send it very briefly in a previous like one or two videos ago but just to make sure it's really
clear in order to create a collection inside of Mongo which stores a list of records we create a model
class using Munger's.
So we make a model class that automatically makes a collection inside of Mongo.
Once we create that collection once recreate that model class then whenever a user signs in or signs
up I should say to our application we will save a new record to that users collection that contains
their Google I.D. will then be able to associate surveys with them or any other type of resources we
have in our application and we will also be able to allow users to sign out and then sign back in at
some point in the future.
OK.
So again just want to make sure that we are really on the same page about what we are trying to accomplish
right now and why we are using mongoose and lango.
So now that we're a little bit more calibrated Let's take a quick break.
We're going to come back in the next section and continue by creating a model class that will be used
to make our mongoose or Mongo collection of users.
So let's get to it in the next section.