【发布时间】:2015-04-20 11:29:51
【问题描述】:
我有一个带有sails.js 和mongodb 的应用程序。
sails rest api 适用于创建。当我以“http://localhost:1337/student”的身份访问它时,它也可以正常工作,但在查找 ID 为“http://localhost:1337/student/54e57a98469768d40df7fb24”的特定文档时无法正常工作。
db 中的对象 id 存储为 _id : ObjectId("54e57a9e469768d40df7fb25")。
我也尝试更新 Controller 中的记录,但这似乎也不起作用:
Student.update({id:Student.mongo.objectId(req.body.id)},{is_active:0}).exec(function(err, data){ ………… }); 任何帮助将不胜感激。
谢谢。
【问题讨论】:
标签: mongodb sails.js sails-mongo