Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

请教mongoose分组统计该怎么写呢

$
0
0

假如我有如下两个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'}
});

Viewing all articles
Browse latest Browse all 14821

Trending Articles