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

$top/$skip not working within $expand #32

Open
blitzmann opened this issue Jun 23, 2021 · 0 comments
Open

$top/$skip not working within $expand #32

blitzmann opened this issue Jun 23, 2021 · 0 comments

Comments

@blitzmann
Copy link
Contributor

{{base_url}}/api/authors?$expand=posts($orderby=id desc;$top=1)&$filter=id eq 5

This returns

[
    {
        "id": 5,
        "name": "Emmanuel Salinas",
        "posts": [
            {
                "id": 10,
                "title": "Cursus Ltd",
                "text": "ac mattis ornare, lectus ante dictum mi, ac mattis velit"
            },
            {
                "id": 5,
                "title": "Habitant Morbi Tristique Corp.",
                "text": "Suspendisse"
            }
        ]
    }
]

I would expect it to return (taking the first value that is returned)

[
    {
        "id": 5,
        "name": "Emmanuel Salinas",
        "posts": [
            {
                "id": 10,
                "title": "Cursus Ltd",
                "text": "ac mattis ornare, lectus ante dictum mi, ac mattis velit"
            }
        ]
    }
]

Granted, this might be a limitation in TypeORM. If you're trying to page records within a join, I believed that would require a subquery instead of just joins. I'm going to poke around and see what I find out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant