Video Course

Create a CRUD App with Node and MongoDB: Lesson 6 of 17

MongoDB Start

Up Next

Environment Variables

Autoplaying in 7 seconds!

Cancel

Create a Free Account to Watch

Sign Up Now

Login to your account

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:

mongoose.connect('mongodb://<user>:<pass>@localhost/<dbname>');

Chris Sevilleja

156 posts

Co-founder of Scotch.io. Slapping the keyboard until something good happens.