I am currently working with the following article schema:
var articleSchema=new Schema({
id : Number,
title : String,
sefriendly : String,
created : Date,
categories: [
{
id: Number,
name: String,
sefriendly: String,
image: String
}
],
author: {
id: Number,
name: String
}
});
I am looking to retrieve the latest article for each category from a set of categoryIds, sorted by the 'created' field. For example, if my categories include Cinema, TV, Music, and Books, I want to retrieve the latest article for each category. Is it possible to achieve this in a single query?