我正在使用 waterline 和 waterlinhe-orientdb。我有用户和订单顶点类并购买了边缘类用户---已购买-->订单我正在尝试应用 Where 标准来填充。但不适用于填充。这是我的代码
var CREDIT_CARD = 1;
User.find({id:userid}).populate('boughts',{where:{payment_method:CREDIT_CARD}})
架构
USER = {
identity: 'user',
connection: 'myLocalOrient',
attributes:{
status: { type:"integer", columnName:"status"},
fname: { type:'string'},
lname: { type:'string'},
boughts: {collection: 'orders',through: 'boughts',via: 'user',dominant: true}
};
Bought = {
identity:'boughts',
connection: 'myLocalOrient',
attributes:{
status:{type:'integer', columnName:'status'},
buyers:{
columnName: 'out',
type: 'string',
foreignKey: true,
references: 'users',
on: 'id',
onKey: 'id',
via: 'orders'
},
orders:{
columnName: 'in',
type: 'string',
foreignKey: true,
references: 'orders',
on: 'id',
onKey: 'id',
via: 'buyer'
}
}
};
Order = {
identity:'orders',
connection: 'myLocalOrient',
attributes:{
status:{type:'integer',columnName:'status'},
payment_method:{type:'integer', columnName:'payment_method'},
boughts:{collection:'users', through:'boughts',via:'orders'}
}
};