I have two collections - "products" and "categories". Each product has "category_id" attribute.
I need to select last 30 products, and these products should be in different categories.
categories
{
_id: 'books',
name: 'Books',
},
{
_id: 'computers',
name: 'Computers',
}
products
{
name: 'The Lean Startup',
category_id: 'books',
created: ISODate("2013-05-29T10:37:58.071Z")
},
{
name: 'Start Small, Stay Small',
category_id: 'books',
created: ISODate("2013-05-29T10:37:58.071Z")
}