我正在使用Gulp构建系统。当我尝试使用mongoose
连接到本地MongoDB
时,出现错误mongoose.connect is not a function
。通过猫鼬连接到MongoDB
连接代码:
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
我正在使用Gulp构建系统。当我尝试使用mongoose
连接到本地MongoDB
时,出现错误mongoose.connect is not a function
。通过猫鼬连接到MongoDB
连接代码:
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
你的问题不在于你的反应直接使用獴?
Mongoose是一个节点模块:“用于node.js的优雅的mongodb对象建模”。
你正试图从浏览器使用Mongoose,这是不行的。 – robertklep