Community.HotChocolate.Data.Grouping 0.2.0

dotnet add package Community.HotChocolate.Data.Grouping --version 0.2.0
                    
NuGet\Install-Package Community.HotChocolate.Data.Grouping -Version 0.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Community.HotChocolate.Data.Grouping" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Community.HotChocolate.Data.Grouping" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Community.HotChocolate.Data.Grouping" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Community.HotChocolate.Data.Grouping --version 0.2.0
                    
#r "nuget: Community.HotChocolate.Data.Grouping, 0.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Community.HotChocolate.Data.Grouping@0.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Community.HotChocolate.Data.Grouping&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Community.HotChocolate.Data.Grouping&version=0.2.0
                    
Install as a Cake Tool

Community.HotChocolate.Data.Grouping

Community.HotChocolate.Data.Grouping

NuGet Downloads .NET HotChocolate Docs

๐Ÿ“– Documentation ยท ๐Ÿš€ Quick Start ยท ๐Ÿ“ฆ NuGet ยท ๐Ÿ› Issues


A type-safe GROUP BY aggregation library for HotChocolate GraphQL.

Grouping enables SQL GROUP BY semantics directly in your GraphQL schema.

The key selection set defines the grouping dimensions, aggregate carries the per-bucket numbers, and having filters the buckets, all in one round-trip that translates to a single database query.

query {
  employeeGrouping(where: { active: { eq: true } }) {       # filter rows before GROUP BY
    key {
      company { name }
      department { name }
    }
    count(having: { gt: 1 })                                # drop singleton buckets
    aggregate {
      salary { avg sum min max(having: { gte: 90000 }) }    # keep buckets whose max salary >= 90k
      bonus  { avg }
    }
  }
}
{
  "data": {
    "employeeGrouping": [
      {
        "key": { "company": { "name": "Acme" }, "department": { "name": "Engineering" } },
        "count": 2,
        "aggregate": {
          "salary": { "avg": 90000, "sum": 180000, "min": 80000, "max": 100000 },
          "bonus":  { "avg": 10000 }
        }
      },
      {
        "key": { "company": { "name": "Globex" }, "department": { "name": "Engineering" } },
        "count": 2,
        "aggregate": {
          "salary": { "avg": 92500, "sum": 185000, "min": 90000, "max": 95000 },
          "bonus":  { "avg": 5000 }
        }
      }
    ]
  }
}

The library follows familiar SQL semantics on top of any IQueryable. count is always the row count of the bucket, putting a collection in key flattens like a JOIN, and the schema rejects combinations that would silently change which buckets you get back.

Quick Start

dotnet add package Community.HotChocolate.Data.Grouping
services
    .AddGraphQL()
    .AddFiltering()
    .AddGrouping()
    .AddQueryType<Query>();

public class Query
{
    [UseGrouping]
    [UseFiltering]
    public IQueryable<Employee> GetEmployeeGrouping(MyDbContext db) => db.Employees;
}

That's it. The schema gains employeeGrouping(where, filterNullParent) returning [EmployeeGrouping!]! with key + aggregate. See the Quick Start for a full walkthrough.

Key Features

  • Schema-driven type safety: every operation a field exposes and every having predicate is determined by its scalar type; invalid combinations are unrepresentable in the schema rather than discovered at runtime
  • Selection-driven: key { ... } defines the grouping dimensions; no groupBy argument required
  • Field-first aggregates: salary { avg sum min max }
  • Per-operation HAVING: salary { sum(having: { gt: 100000 }) } filters buckets server-side
  • Nested grouping: group by navigation properties, including across collection navigations
  • Multi-source: any IQueryable provider; in-memory, EF Core, and MongoDB are tested against every query
  • Convention-based: custom scalar types registered via a fluent convention API
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 204 6/25/2026
0.1.0 198 6/11/2026