Skip to content

GroupBy support in Linq queries #569

Closed

Description

@jeremydmiller

No real plans about how far to go with this yet or timing.

Activity

  1. modified the milestone: 1.3 on Oct 31, 2016
  2. modified the milestone: 1.3 on Feb 8, 2017
  3. AKlaus commented on Jan 8, 2018

    @AKlaus

    Queryable.GroupBy() throws an error:

    Could not determine an 'id/Id' field or property for requested document type System.Linq.IGrouping`2
       at Marten.Schema.DocumentMapping.Validate()
       at Marten.Storage.DocumentTable..ctor(DocumentMapping mapping)
       at Marten.Schema.DocumentMapping.<toSchemaObjects>d__129.MoveNext()
       at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
       at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
       at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
       at Marten.Storage.Tenant.generateOrUpdateFeature(Type featureType, IFeatureSchema feature)
       at Marten.Storage.Tenant.ensureStorageExists(IList`1 types, Type featureType)
       at Marten.Linq.MartenQueryable`1.executeAsync[TResult](Func`2 source, CancellationToken token)
       at Marten.Linq.MartenQueryable`1.ToListAsync[TResult](CancellationToken token)
       at Marten.QueryableExtensions.ToListAsync[T](IQueryable`1 queryable, CancellationToken token)
    

    Therefore:

    • Could you please confirm that there is no option of using GROUP BY except manually writing an SQL query?
    • Are there plans to implement the functionality? (looks unlikely, as it's marked for 1.3 milestone and the current version is 2.4).
    • RavenDb provides this functionality via Map-Reduce indexes. Is there a different (or recommended) approach to reduce data by grouping on a field set?

    P.S. I understand that Marten is an open source project and public contribution is more than welcome, but I was very surprised to see lack of grouping functionality.

  4. jeremydmiller commented on Jan 8, 2018

    @jeremydmiller
    MemberAuthor

    @AKlaus You're commenting on the issue in the backlog to add this feature, it's not in the docs, and a very quick search would have shown you that it doesn't appear in any unit test in the codebase.

    So,

    1. Marten does not yet support GroupBy in Linq
    2. Yes, obviously by the existence of this issue
    3. Good for them, and no, not yet

    "I was very surprised to see lack of grouping functionality" -- please don't ever use a phrase like that in an OSS issue.

    It's not already there because it's very hard and time consuming to do from the Linq perspective and not enough folks have wanted it yet. Unlike RavenDb though, you can always revert to Sql and that's the only answer I've got for you here.

  5. AKlaus commented on Jan 9, 2018

    @AKlaus

    Thank you for your prompt answer 👍. I agree with everything you said.
    It made me think whether I'm solving the right problem if usage of GroupBy is a rare requirement on a NoSQL DB.

  6. eouw0o83hf commented on Jan 10, 2019

    @eouw0o83hf
    Contributor

    In response to "not enough folks have wanted it yet," I'd like to toss my hat in the ring for needing GroupBy() linq functionality. Definitely understand low-priority-ness.

  7. robertmaidlaAW commented on Oct 11, 2019

    @robertmaidlaAW

    Checking in on whether this has been added to the to-do list :P

  8. oskardudycz commented on Oct 17, 2019

    @oskardudycz
    Collaborator

    @robertmaidlaAW it's still on the TODO list, although to be fair - not in the top of the priorities (because of our capacity). Next biggest release will be probably mostly focused on Event Store enhancements.

  9. igor-maslennikov commented on May 26, 2021

    @igor-maslennikov

    hello, just checking - any plans to have it covered in the nearest future?

  10. locked and limited conversation to collaborators on Mar 4, 2022
  11. converted this issue into a discussion #2119 on Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions