We're live-coding on Twitch! Join us! FREE Webinar: Should I use React or Vue?

There are a few options for using MongoDB in your project. You could install MongoDB locally, or we can use an online database and connect to it using the URI string.

We'll be connecting to a database we create on mLab. Once you create an account, you can setup a free database and use the connection string that looks like this: mongodb://<user>:<pass>@localhost/<dbname>.

Install mongoose with:

npm install --save mongoose

Then use it in your project by bringing it in:

var mongoose = require('mongoose');

And configuring it:


Like this article? Follow @chrisoncode on Twitter