如何在mongodb上找到此字段(排序依据)和总投票,我使用meteor mongo。这是我的代码
Posts.find({},{limit: 5, sort: {vote: -1,owner:-1}});
它不起作用
{
"_id":123,
"owner":"yuda",
"vote":12
}
{
"_id":124,
"owner":"yuda",
"vote":3
}
{
"_id":125,
"owner":"lucy",
"vote":42
}
我需要按所有者和总投票排序结果:
{
"owner":"lucy",
"vote":42
}
{
"owner":"yuda",
"vote":15
}
感谢