Cousin13
Cousin13

Reputation: 1

Connection to MongoDB via mongoose

I am using Gulp building system. When I try to connect to my local MongoDB using mongoose I got error mongoose.connect is not a function.

Connection code:

var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');

Upvotes: 0

Views: 90

Answers (2)

Snahedis
Snahedis

Reputation: 231

Your problem isn't that you're using mongoose directly in react ?

Mongoose is a node module: "elegant mongodb object modeling for node.js".

Upvotes: 0

iH8
iH8

Reputation: 28638

Your code seems fine. Are you sure you correctly installed mongoose?

npm install --save mongoose

Upvotes: 1

Related Questions