假设我具有以下文档结构。
{
"_id" : "ehbpidnopgpgcghgakiiiallielefonk",
"users" : 11.87,
"ratingTopMost" : {
"average" : NumberInt("4"),
"users" : NumberInt("3174"),
},
"reviews" : {
"average" : NumberInt("5"),
"count" : NumberInt("51"),
"comments" : [
{
"_id" : ObjectId("5b87b1a07267ad001da7e733"),
"name" : "Batista1395",
"comment" : "Great Stackoverflow",
"datum" : ISODate("2017-01-16T00:00:00.000+01:00"),
"rating" : NumberInt("3")
},
{
"_id" : ObjectId("5b87b1a07267ad001da7e732"),
"name" : "Tim Ace",
"comment" : "I Like it.",
"datum" : ISODate("2016-08-17T00:00:00.000+02:00"),
"bewertung" : NumberInt("5")
},
]
},
}
我需要使用以下标准查询前最多20个文档:
优先级应该从上到下(1到5)。
也很不错:按日期DESC对嵌入的注释进行排序。