バックボーン、ノード:フェッチメソッドを呼び出すと、サーバーでフェッチが成功しますが、応答を返すと
res.send(result)
モデルを送信していないか(送信している可能性があります)、古いモデルを返送しており、応答オブジェクトのみを送信しています。モデルは私が欲しいものですが、どうすれば入手できますか?
app.get('/college/colleges/:_id', function (req, res) {
oid = new ObjectID(req.params._id.toString());
return CollegeModel.find({
_id: oid
}, function (err, result) {
if (!err) {
console.log("Fetched college model successfully");
res.send(result);
} else {
console.log("Error : " + err);
res.send(err);
}
});
});
上記のコードは node にあります。以下はクライアントの JavaScript です (ビュー内)。
college_model = new CollegeModel(id)
college_model.fetch({
success = function (model, res, options) {
console.log model // here , new model should come with all new attributes, but old model with only id attribute is appearing here,,,in model format.
console.log res // here, i am getting all required records in objectformat,no problem for this res
}
error = function (model, res, options) {
console.log("Error ");
}
})
ありがとう