Я следующие документы в моей коллекцииМонго Aggregation
{
"_id": ObjectId("54490b8104f7142f22ecc97f"),
"title": "Sample1",
"slug": "samplenews",
"cat": "sports",
"desc": "sampletextsampletext",
"published_date": ISODate("2014-10-23T14:06:57.0Z"),
} {
"_id": ObjectId("54490b8104f7142f22ecc97f"),
"title": "Sample2",
"slug": "samplenews2",
"category": "entertaintment",
"desc": "sampletextsampletext",
"published_date": ISODate("2014-10-22T14:06:57.0Z"),
} {
"_id": ObjectId("54490b8104f7142f22ecc97f"),
"title": "Sample3",
"slug": "samplenews3",
"category": "entertaintment",
"desc": "sampletextsampletext",
"published_date": ISODate("2014-9-22T14:06:57.0Z"),
} {
"_id": ObjectId("54490b8104f7142f22ecc97f"),
"title": "Sample4",
"slug": "samplenews4",
"category": "other",
"desc": "sampletextsampletext",
"published_date": ISODate("2014-10-22T14:06:57.0Z"),
}
мне нужно один запрос, чтобы получить 5 топ последних новостей из каждого предложения category.any?
Спасибо, что работает. –