You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
@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,
Marten does not yet support GroupBy in Linq
Yes, obviously by the existence of this issue
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.
Reacted by Nathan Landis, Sergey Trifonov and Elliot
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.
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.
Reacted by Önder Gür
Reacted by Alex Klaus, cocowalla, Michael Lehto, Tobias Zimmergren, Alexander Sidorov, Arild Bøifot, Sergey Trifonov, robertmaidlaAW and Elliot
@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.
Activity
AKlaus commentedon Jan 8, 2018
Queryable.GroupBy()throws an error:Therefore:
GROUP BYexcept manually writing an SQL query?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.jeremydmiller commentedon Jan 8, 2018
@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,
"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.
AKlaus commentedon Jan 9, 2018
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.
eouw0o83hf commentedon Jan 10, 2019
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.robertmaidlaAW commentedon Oct 11, 2019
Checking in on whether this has been added to the to-do list :P
oskardudycz commentedon Oct 17, 2019
@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.
igor-maslennikov commentedon May 26, 2021
hello, just checking - any plans to have it covered in the nearest future?