#這段程式碼錯誤
var queryAll = user_model.find();
,不知道這段程式碼錯在哪裡,麻煩有經驗的人幫忙看哈,
// login action
const express = require('express');
var mongoose = require('mongoose');
var User_Model = mongoose.model('User_Model');
const router = express.Router();
router.get('/',(req,res,next)=>{
res.render('login.html');
});
module.exports=router;
router.post('/',(req,resp,next)=>{
debugger;
//连接数据库
mongoose.connect('mongodb://127.0.0.1:27017/likeread',(err)=>{
if(err)
console.log('err');
});
console.log(mongoose);
var user_model = new User_Model();
debugger;
//查找数据
var queryAll = user_model.find({});
queryAll.exec((err,result)=>{
if(err){
console.log(err);
}else{
console.log(result);
}
});
debugger;
user_model.close((err,res)=>{
if(err){
console.log(err);
}
});
debugger;
resp.end();
});
var queryAll = User_Model.find({});