OData .Net Core simple nested query fails

Given the simple nested class below odata call fails with error message

OData: $filter=detailed/value eq ‘test’

Exception has been thrown by the target of an invocation.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
—> System.InvalidOperationException: IIF(({document}{Detailed} == null), null, {Detailed.Value}) is not supported.

I understand you do not have a full OData with queryable support but i’m looking for ways forward for us since we try to adopt at least basic OData support in all our APIs.

Questions:

  • Is there any other odata query i can write that will work for a simple nested model?
  • Is there any other solution available to us rather than a complete flat document?
  • Am I doing something wrong here that I should be doing in another way?

Versions
MongoDB.Driver: 2.12.0
MongoDB 4.4.4 Community
Microsoft.AspNetCore.OData: 5.x

public class MainClass
{
    public Guid Id { get; set; }
    public NestedClass Detailed { get; set; }
}

public class NestedClass
{
    public string Value { get; set; }
}

Did you managed to solve this?

1 Like

Is there any news about it?
We would really need to have this issue resolved in order to move forward with our solution.