Sails.js SailsJS存在选择、排序和填充问题
我想用所选字段检索最后2张客户发票,但选择、排序不使用填充,这是不使用Model.query解决此问题的任何方法Sails.js SailsJS存在选择、排序和填充问题,sails.js,Sails.js,我想用所选字段检索最后2张客户发票,但选择、排序不使用填充,这是不使用Model.query解决此问题的任何方法 Customer.find({customer_type: 'full'}) .populate('invoices', { invoice_type: 'monthly', select: ['id', 'customer_id', 'discount', 'total'], sort:{
Customer.find({customer_type: 'full'})
.populate('invoices', {
invoice_type: 'monthly',
select: ['id', 'customer_id', 'discount', 'total'],
sort:{invoice_date: 'desc'}
limit: 2
}).exec(function(err, custumers){ //-------- });
更新。在新的吃水线v0.12中,您可以使用选择填充方法
在当前的Waterline v.0.11中,只能使用Model.query解决此问题