假如我有如下两个Collection:颜色和花,我要按颜色统计,对应的花的数量应该怎么写呢?用mongoose。
var color = new mongoose.Schema({
color: {type: String}
});
var flower = new mongoose.Schema({
name:{type:String},
color: {type: mongoose.Schema.ObjectId,ref:'Color'}
});
假如我有如下两个Collection:颜色和花,我要按颜色统计,对应的花的数量应该怎么写呢?用mongoose。
var color = new mongoose.Schema({
color: {type: String}
});
var flower = new mongoose.Schema({
name:{type:String},
color: {type: mongoose.Schema.ObjectId,ref:'Color'}
});