"where" after "group by" not working

Description

I've looked other issues, I didn't find this one. I apologize if I accidently duplicated the issue.
These are couple of queries I've tried to execute:

session.Query<Product>().GroupBy(p => p.Category.CategoryName).(g => g.Key.StartsWith("C")).Select(g => new { Name = g.Key, Count = g.Count() });

session.Query<Product>().GroupBy(p => p.Category.CategoryName).(g => new { Name = g.Key, Count = g.Count() }).Where(g => g.Name.StartsWith("C"));

session.Query<Product>().GroupBy(p => p.Category.CategoryName).Where(g => g.Count() > 10).Select(g => { Name = g.Key, Count = g.Count() });

Expected result in first two queries was number of products in categories whose name starts with "C", and in the third one, list of categories where number of products in category is greater that 10. Instead, first two queries throw the exception, and the last one returns incorrect result, it returns all categories. It looks like whenever we have Where clause after GroupBy it doesn't work.

Environment

None

Assignee

Unassigned

Reporter

Nikola Misic

Labels

None

Components

Affects versions

Priority

Blocker
Configure