We got all the data scraped that we need from Craigslist.
We got the job listings and the job descriptions.
And now we need to save the data somewhere because right now it's not being saved at all.
And a really popular choice to use when you're dealing with JavaScript especially, is to use a MongoDB
database.
So a MongoDB database simply just saves the data pretty much as we have it in the code.
It just saves it as different objects inside of a database or a collection.
In this case, instead of an array, we have a collection and instead of an object, we call it documents.
So same thing, but new names.
Anyway, I'm going to use a cloud service that is called M-lab.
And M-lab is free for smaller databases, which means 500MB, which is plenty enough to make small test
projects or little test prototypes.
I have never been able to get past my limit on the smaller projects projects I've been doing.
So highly recommend it.
Go ahead, sign up.
You can also use your own database.
MongoDB database.
Set it up.
But I just find it so easy and convenient to set up MongoDB databases with M-lab.
So anyway, let me show you.
Once you're signed up, go ahead.
I'm going to go into manage here and then in here I'm going to say create a new database.
And then you can choose which cloud provider you want to use.
It doesn't really matter which one you use.
I don't see any difference.
Maybe the location will be different, but I'm just going to go ahead with Amazon and say Free Sandbox
and we can see the regions available to me.
And then I say continue and I choose the one that is closest to me, that is in Europe.
And then I say continue and I give the database a name.
Let's call it Craigslist listings.
So I already have here and continue and submit order.
Now it's going to go ahead and create this little free sandbox database at Amazon.
It's only going to take a couple of seconds usually.
And there we go.
Now, the database has already been created, and I can go ahead and click on it.
And in here I can see there is the collections.
There's no collections right now because we haven't been saving any data.
But we need to create a user that can connect to this database.
We are going to use this user inside of our NodeJS code.
So go ahead inside users and click on Add database User.
And then let's give it a username.
So Craigslist user, and then let's give it a super strong password.
And it has to be with one numeric character.
So super strong Password one.
And then I say, Great.
And there we go.
Now I have a user and a password set up, so make sure to save this password somewhere.
And the user also Craigslist user and the password is super strong.
Password one We are now going to use Mongoose to connect to the database in the next section.