在sails更新查询中得到问题
我是新的帆JS,并得到一些问题,我的更新查询显示更新成功,但它并没有更新MongoDB收集logging。 我不在哪里做愚蠢的错误。
这是控制器function
edit: function(req, res){ var uid = req.params.id; console.log("Request body----------" +uid); console.log(req.body.heading); console.log(req.body.message); Dashboard.update( { _id : uid }, {title : "req.body.heading" , description : "req.body.message" }).exec(function(err, doc){ if(err){ console.log("Error while update"+err); }else{ console.log("Successfuly Updated"); res.redirect('dashboard/index'); } }); }
这是模型文件:
module.exports = { attributes: { title:{ type:'string', //required:true, columnName:'title' }, description: { type:'text', columnName:'description' }, posted_by: { type: 'integer', columnName: 'posted_by' } }
控制台消息显示此
Successfully Updated
任何一个帮助将不胜感激提前
使用id
是_id
像是
Dashboard.update( { id : uid }, {title : "req.body.heading" , description : "req.body.message" } )
这是Waterline
公约。