1 00:00:00,740 --> 00:00:04,700 And the last section we finished wiring up longers to our express API. 2 00:00:04,880 --> 00:00:10,080 Now before we just dive in face first and start writing some code and Mongoose I want to take a very 3 00:00:10,080 --> 00:00:11,620 quick pause. 4 00:00:11,640 --> 00:00:18,030 We spent the last 30 minutes or so talking about some very detailed and very complex topics around authentication 5 00:00:18,060 --> 00:00:19,950 inside of our application. 6 00:00:19,950 --> 00:00:25,390 Now at this point you might be sitting there thinking like Steven what are we using mongoose for. 7 00:00:25,770 --> 00:00:30,320 Why are we finishing up the passport's stuff like where are we what are we trying to do here. 8 00:00:30,360 --> 00:00:35,360 And so I wanted to just take a break and make sure that we are really on the same page about what we 9 00:00:35,360 --> 00:00:39,810 are trying to accomplish right now and how we are going to accomplish it. 10 00:00:39,880 --> 00:00:40,130 OK. 11 00:00:40,170 --> 00:00:42,090 So let's get to this. 12 00:00:42,210 --> 00:00:47,880 We just finished provisioning a remote instance of Mongo and then we hooked it up to our application 13 00:00:48,030 --> 00:00:50,340 by using the mongoose library. 14 00:00:50,400 --> 00:00:57,480 The reason that we brought in the idea of a database at all into our application is to satisfy one very 15 00:00:57,480 --> 00:01:00,750 basic need inside of our authentication process. 16 00:01:00,900 --> 00:01:08,220 We need the ability to identify users who initially sign up for application sign out and then come back 17 00:01:08,220 --> 00:01:14,100 at some point in the future and sign in again every single time that a user signs up initially for our 18 00:01:14,100 --> 00:01:15,120 application. 19 00:01:15,120 --> 00:01:21,150 We're going to take that I.D. property out of their google profile and create a new record inside of 20 00:01:21,150 --> 00:01:28,710 our Mongo database that saves that I.D. We will then be able to save surveys or posts or e-mails or 21 00:01:28,860 --> 00:01:36,390 any other type of data we have in our application and pointed to that user record and say OK this user 22 00:01:36,450 --> 00:01:40,920 owns this survey and this post and whatever else. 23 00:01:41,180 --> 00:01:47,700 Now to make that actually happen we're going to use mongoose to create a new collection of records in 24 00:01:47,700 --> 00:01:52,440 Mago which we're going to refer to as our users collection. 25 00:01:52,440 --> 00:01:53,850 So that's why we installed mongoose. 26 00:01:53,850 --> 00:01:56,830 We're going to use it to create this new collection. 27 00:01:56,910 --> 00:02:01,470 Now we send it very briefly in a previous like one or two videos ago but just to make sure it's really 28 00:02:01,470 --> 00:02:08,550 clear in order to create a collection inside of Mongo which stores a list of records we create a model 29 00:02:08,550 --> 00:02:10,610 class using Munger's. 30 00:02:10,830 --> 00:02:16,630 So we make a model class that automatically makes a collection inside of Mongo. 31 00:02:17,730 --> 00:02:23,790 Once we create that collection once recreate that model class then whenever a user signs in or signs 32 00:02:23,790 --> 00:02:30,870 up I should say to our application we will save a new record to that users collection that contains 33 00:02:31,080 --> 00:02:37,980 their Google I.D. will then be able to associate surveys with them or any other type of resources we 34 00:02:37,980 --> 00:02:43,410 have in our application and we will also be able to allow users to sign out and then sign back in at 35 00:02:43,410 --> 00:02:45,470 some point in the future. 36 00:02:45,480 --> 00:02:45,820 OK. 37 00:02:45,840 --> 00:02:50,400 So again just want to make sure that we are really on the same page about what we are trying to accomplish 38 00:02:50,400 --> 00:02:53,360 right now and why we are using mongoose and lango. 39 00:02:53,730 --> 00:02:56,760 So now that we're a little bit more calibrated Let's take a quick break. 40 00:02:56,760 --> 00:03:02,250 We're going to come back in the next section and continue by creating a model class that will be used 41 00:03:02,250 --> 00:03:06,640 to make our mongoose or Mongo collection of users. 42 00:03:06,660 --> 00:03:08,880 So let's get to it in the next section.