Add MongoDB to a Node Application – Opensite - Digital Solutions Agency

0422 374 731 info@opensite.com.au

Add MongoDB to a Node Application

Last update:

Tutorials , ,

We’ll use the mongooseJS Node package to work with MongoDB.

Connect to a database, it doesn’t even need to exist yet. In this example db_name will be created.

// grab the packages 
var mongoose = require('mongoose');

mongoose.connect('mongodb://localhost/db_name');