groupBy
The groupBy clause is used to group documents by a specific property:
posts.lunaql
query({
from({
posts: {
groupBy(["user_id"]);
};
});
});You can also group by multiple properties:
posts.lunaql
query({
from({
posts: {
groupBy(["user_id", "created_at"]);
};
});
});💡
When using groupBy, LunaQL will add a _count property to all the grouped objects.