WEBVTT

00:00.720 --> 00:04.140
We got all the data scraped that we need from Craigslist.

00:04.170 --> 00:07.710
We got the job listings and the job descriptions.

00:08.460 --> 00:12.840
And now we need to save the data somewhere because right now it's not being saved at all.

00:13.350 --> 00:19.560
And a really popular choice to use when you're dealing with JavaScript especially, is to use a MongoDB

00:19.560 --> 00:20.460
database.

00:20.730 --> 00:27.420
So a MongoDB database simply just saves the data pretty much as we have it in the code.

00:27.420 --> 00:33.660
It just saves it as different objects inside of a database or a collection.

00:33.660 --> 00:40.440
In this case, instead of an array, we have a collection and instead of an object, we call it documents.

00:40.440 --> 00:43.200
So same thing, but new names.

00:43.750 --> 00:48.160
Anyway, I'm going to use a cloud service that is called M-lab.

00:48.490 --> 00:58.540
And M-lab is free for smaller databases, which means 500MB, which is plenty enough to make small test

00:58.540 --> 01:02.500
projects or little test prototypes.

01:02.590 --> 01:09.610
I have never been able to get past my limit on the smaller projects projects I've been doing.

01:09.940 --> 01:11.790
So highly recommend it.

01:11.800 --> 01:13.090
Go ahead, sign up.

01:13.120 --> 01:16.000
You can also use your own database.

01:16.000 --> 01:17.110
MongoDB database.

01:17.110 --> 01:17.740
Set it up.

01:17.740 --> 01:23.800
But I just find it so easy and convenient to set up MongoDB databases with M-lab.

01:24.160 --> 01:25.690
So anyway, let me show you.

01:25.720 --> 01:27.790
Once you're signed up, go ahead.

01:27.790 --> 01:35.440
I'm going to go into manage here and then in here I'm going to say create a new database.

01:39.060 --> 01:42.330
And then you can choose which cloud provider you want to use.

01:42.330 --> 01:44.700
It doesn't really matter which one you use.

01:44.700 --> 01:46.280
I don't see any difference.

01:46.290 --> 01:54.210
Maybe the location will be different, but I'm just going to go ahead with Amazon and say Free Sandbox

01:54.210 --> 01:57.060
and we can see the regions available to me.

01:57.390 --> 02:03.330
And then I say continue and I choose the one that is closest to me, that is in Europe.

02:04.080 --> 02:07.710
And then I say continue and I give the database a name.

02:07.710 --> 02:09.570
Let's call it Craigslist listings.

02:09.690 --> 02:15.690
So I already have here and continue and submit order.

02:17.400 --> 02:22.860
Now it's going to go ahead and create this little free sandbox database at Amazon.

02:22.980 --> 02:26.070
It's only going to take a couple of seconds usually.

02:29.710 --> 02:30.460
And there we go.

02:30.460 --> 02:34.890
Now, the database has already been created, and I can go ahead and click on it.

02:37.750 --> 02:40.840
And in here I can see there is the collections.

02:40.840 --> 02:44.530
There's no collections right now because we haven't been saving any data.

02:44.710 --> 02:48.450
But we need to create a user that can connect to this database.

02:48.460 --> 02:52.420
We are going to use this user inside of our NodeJS code.

02:52.810 --> 02:57.400
So go ahead inside users and click on Add database User.

02:58.110 --> 03:01.290
And then let's give it a username.

03:01.290 --> 03:09.180
So Craigslist user, and then let's give it a super strong password.

03:10.300 --> 03:14.560
And it has to be with one numeric character.

03:14.560 --> 03:18.940
So super strong Password one.

03:20.680 --> 03:22.270
And then I say, Great.

03:26.560 --> 03:27.970
And there we go.

03:27.970 --> 03:33.280
Now I have a user and a password set up, so make sure to save this password somewhere.

03:33.280 --> 03:39.610
And the user also Craigslist user and the password is super strong.

03:39.610 --> 03:47.080
Password one We are now going to use Mongoose to connect to the database in the next section.
