That's created inside M-lab will be called listings.
And then we have the schema we also pass in so listing schema.
And then we can simply just export this listing model so that we can create it somewhere else.
So module exports and then listing.
Now I can import this model inside of Index.js.
So let's go ahead and do that.
So const listing require.
And then we go into the model folder and say Listing.
And now in here, we can then save the MongoDB model and watch how it comes up in our database.
So now once we are in the scrape job descriptions method, we basically have gotten all the data that
we need for all of these listings.
So then it would be a nice point in time to save this listing data up in the MongoDB database.
Before we move on to the next listing item, so what we can do now is to say we can do something where
we can say await, where we can say const listing model.
And then we can say new listing and then we can just pass in the object of this listing.
So listings on the I index and then we can say listing model dot save and make sure also to have a wait
in front of that.
So now when we run the scraper through, we should be able to see inside the M-lab database that the
listings are being saved up.
Inside the listings collection.
So now I'm going to go ahead and write.
Node Index.js.
And then let's see if it updates our database.
So now it's going through some job descriptions.
And then if I go into let's try and go into M-lab database and see if it saves our listings.
So I can already see when I go into the database for Craigslist listings that there is a new collection
that has been created which is called listings.
And if I click on the collection in here.
I can see all of this collection of listing objects or listing documents.
And in here you can see all of the data that we are saving.
I can see the title, the URL, the date it was posted, and the job description, as well as the compensation
of the job.
There's also been a unique ID that's been attached to the object or the document, which is a MongoDB
specific thing.
It's just a unique ID or a key to lock up to look up an item in the MongoDB database.
So people.
That is all of it.
And now you've seen how to scrape specific data.
You've seen how to open up puppeteer and navigate around on pages with the puppeteer and scrape the
content from a page with Cheveyo as well.
And you also seen how to save the data up into MongoDB.
And yeah, that's all you need to know for a lot of the tasks you'll be doing in the scraping Adventure.
Now you're free to also see my other sections where we also make a API and use a front end to present
the data we are scraping or a CSV file.
If you want to save the data onto a CSV file instead, you can also do that.
I would recommend that you save it onto a database first of all, because then you always have your
data at one place and it's easy to take it from there and manipulate it however you want to use it.
So that's all for now, folks.
If you have any requests or questions, then please let me know and I'll try to get back to you as soon
as possible.