简体   繁体   中英

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');

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

npm install --save mongoose

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM