假设以下3个模型:
var CarSchema = new Schema({
name: {type: String}
});
CarSchema.virtual('parts', {
ref: 'Part',
localField: '_id',
foreignField: 'car',
justOne: false,
});
var PartSchema = new Schema({
name: {type: String},
otherIds: [{type: Schema.Types.ObjectId, ref: 'Other'}],
car: [{ type: Schema.Types.ObjectId, ref: 'Car' }]
});
var OtherSchema = new Schema({
name: {type: String}
});
猫鼬是否可以在查找查询中检查虚拟填充的 零件 字段的长度?
有没有办法忽略猫鼬中的空白数组?