任何人都可以将该查询转换为mongo for java(org.springframework.data.mongodb.core.MongoOperations)???将查询mongo转换为spring Mongooperations
我一直无法使用Java进行搜索。
谢谢。
db.respostas.aggregate([
{
"$group":{
"_id":{
"per":"$pergunta",
"res":"$resposta"
},
"respostaCount":{
"$sum":1
}
}
},
{
"$group":{
"_id":"$_id.per",
"respostas":{
"$push":{
"resposta":"$_id.res",
"count":"$respostaCount"
}
},
"count":{
"$sum":"$respostaCount"
}
}
},
{
"$sort":{
"count":-1
}
}
])
请添加你到目前为止尝试过的。 – Veeram
什么我就是这样,因为我不知道该怎么办@Veeram:'聚集AGG = newAggregation( \t \t \t组( “pergunta”, “resposta”) \t \t \t \t .Count中()作为。 ( “respostaCount”), \t \t \t组(), \t \t \t排序(Sort.Direction.DESC, “计数”) \t);' – Laisson
请加样本文档 – Veeram