1
我想用貓鼬例如最後一個版本做一團:組查詢中使用貓鼬4.11.0
Patient.group({gender:true})
.then((result)=>{
console.log(result);
});
患者是模型,你知道怎麼做呢?
我想用貓鼬例如最後一個版本做一團:組查詢中使用貓鼬4.11.0
Patient.group({gender:true})
.then((result)=>{
console.log(result);
});
患者是模型,你知道怎麼做呢?
你在找什麼是mongoDB aggregation管道。下面將性別組的基礎上,病人文件:我可以通過組虛擬元素
Patient.aggregate(
[
//{
// $match: {email: {$exists: true}} //you can also match some criteria
//},
{
$group: {
_id: "$gender"
}
}
]
)
.then((result) => {
console.log(result);
});
? – user3342209
Mongoose虛擬放在一起在客戶端(節點),而不是堅持在數據庫。這就是爲什麼命名虛擬。所以,不,你不能分組虛擬。 –