Hi, I'm new to KMongo and I would like to return number of elements in an Array in a specific document
something like this:
val result = chats.aggregate<Result>("[{\$match : {_id:'$chatId'}}, {\$project: { _id : 1, messageCount : {\$size: '\$messages'}}}]")
But, I need to do it in a transaction, because I use the result later.
But I can't find an aggregate function that would accept a ClientSession and a String. Only ClientSession and List<Bson>. Unfortunately from what I tried, it seems I can't use the size aggregation in Bson.
I'm probably overlooking something. Any ideas how can I do it?
Thank you