}
/**更新问题的某些属性*/
@At("/question/?/update")
public Object update(String questionId, @Param("..")Question question, @Attr("me")User me) {
Question q = dao.findById(Question.class, questionId);
if (q == null)
return Ajax.fail().setMsg("Question not found");
if (!me.getId().equals(q.getUser().getId()))
return Ajax.fail().setMsg("You don't own this question");
if (question == null)
return Ajax.fail().setMsg("No data");
if (Lang.length(question.getTitle()) >= 5 || Lang.length(question.getTitle()) <= 100)
dao.update(Question.class, new BasicDBObject("_id", new ObjectId(questionId)), Moo.SET("title", question.getTitle()));