Select Specific Fields From Query Using WaterlineJS
In WaterlineJS you can use select
projection to pull specific fields:
Model.find({ id: 1 }, {
select: ['id', 'name']
}).limit(1).exec((err, res) => {
});
This syntax is deprecated. Here for reference:
Model.find({ id: id }, {
fields: {
id: 1,
name: 1
}
}).limit(1).exec((err, res) => {
});
fields
will not work with findOne
or any of the singular returning types.