在Sails中,我不需要每次在find,update或populate方法中都使用UpdatedAt和createdAt列。
在猫鼬中,我们可以这样做:
db.collection.find({},
{
UpdatedAt:0,
createdAt:0
})
但在风帆中,我不知道该怎么做。
有没有选择这样做。
使用此代码选择特定字段:
Model.find({field: 'value'}, {select: ['column1', 'column2']})
.exec(function(err, results) {
if(err) {
}
res.json(results);
});
但是你必须为此定义一个标准。