【发布时间】:2018-02-16 14:07:09
【问题描述】:
我有一个报告模型:
const mongoose = require('mongoose');
var Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;
const reportSchema = new mongoose.Schema({
score: Number,
notes: String,
user: ObjectId,
date: Date
}, {timestamps: true})
const Report = mongoose.model('Report', reportSchema);
module.exports = Report
但是当我发现它说函数不存在:
report.find({}, function(err, docs){
console.log(docs)
})
【问题讨论】:
-
你的意思是
Report是吗?你怎么require举报模特? -
您的文件中是否需要猫鼬?
-
实际上,既然您提到了它,我正在使用以下报告,这可能是我的问题: var report = new Report({ score: req.body.score, notes: req.body.notes , 用户: req.user.id, 日期: mydate });
-
看起来是区分大小写的问题。使用报告而不是报告