Starts in:
2 DAYS
4 HRS
38 MIN
3 SEC
Starts in:
2 D
4 H
38 M
3 S
Open Closed

Expression Not Supported Error on Group Join (MongoDB) #6061


User avatar
0
neethucp created
  • ABP Framework version: v7.4.0
  • UI Type: Blazor Server
  • Database System: MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

Hi,

We are getting the following when trying to join collections.

                    from licence in (await GetMongoQueryableAsync<Licence>())
                    join licenceParty in ((await GetMongoQueryableAsync<LicenceParty>())) on licence.Id equals licenceParty.LicenceId into licenceParties
                    select new { licence, licenceParties };

Expression not supported: LicenceParties.Aggregate([]).Where(e => (Convert(e, ISoftDelete).IsDeleted == False)).Where(e => (Convert(e, IMultiTenant).TenantId == 1841fe4f-3eef-8282-6391-3a0e5870cd67)) in Licences.Aggregate([]).Where(e => (Convert(e, ISoftDelete).IsDeleted == False)).Where(e => (Convert(e, IMultiTenant).TenantId == 1841fe4f-3eef-8282-6391-3a0e5870cd67)).GroupJoin(LicenceParties.Aggregate([]).Where(e => (Convert(e, ISoftDelete).IsDeleted == False)).Where(e => (Convert(e, IMultiTenant).TenantId == 1841fe4f-3eef-8282-6391-3a0e5870cd67)), licence => licence.Id, licenceParty => licenceParty.LicenceId, (licence, licenceParties) => new <>f__AnonymousType0`2(licence = licence, licenceParties = licenceParties)) because inner expression is not an IMongoQueryable representing a collection.


3 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can refer to this code: https://github.com/abpframework/abp/blob/dev/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Comments/MongoCommentRepository.cs

  • User Avatar
    0
    neethucp created

    Hi,

    We are trying to integrate OData using https://github.com/mongodb/mongo-aspnetcore-odata package. We need to return an IQueryable and not list.

    If we use (dbContext.Collection<LicenceParty>().AsQueryable()) instead of ((await GetMongoQueryableAsync<LicenceParty>())), it fixes the error, but not sure on how to apply the data filters.

    I have provided the sample for brevity, but this will be a more complex query with multiple joins like licence party joined to Party etc. We have tried a few methods but was getting error in the query.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    It looks like a problem with the MongoDB driver

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06