Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for filtering, projecting and sorting of nested fields #76

Open
craigedmunds opened this issue Sep 21, 2024 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@craigedmunds
Copy link

craigedmunds commented Sep 21, 2024

We want to be able to support sorting, paging & filtering of nested documents.

So given “transactions” records like

{
    user : {
      name : string, dob:date
    },
    created: date,
    amount: int
}}

You should be able to query things like:
?sort=user.name
?fields[transaction]=user.name
?filter[user.name][eq]=whatever

We’ve considered using a different framework, and are happy to contribute if a design is agreed.

@craigedmunds craigedmunds added the enhancement New feature or request label Sep 21, 2024
@bkoelman
Copy link
Member

Yes, something like that would be great to have. To implement that, the ResourceGraph first needs to be extended to support these inline/complex properties, which is also required for json-api-dotnet/JsonApiDotNetCore#1439. Then query string parsers can validate input against the resource graph. Then query translation needs to be extended to emit LINQ expressions for them.

I suspect it can be done with EF Core, just haven't investigated it deeply yet. I don't know if the MongoDB LINQ provider can handle such queries (but the answer is likely yes).

Some experimentation, followed by a working prototype, would help to discover how to best design this. For example, we could inherit from AttrAttribute or from ResourceFieldAttribute, or enhance the existing AttrAttribute. This depends on their usages throughout the codebase, what information is needed where, etc.

@bkoelman
Copy link
Member

@craigedmunds Are you still interested in contributing to achieve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants