Skip to content

Default scope options override options provided with rest queries #678

Description

@vlamic

Hi,

First of all thank you guys for the amazing framework. I love it!

I'm not sure if it's an issue or I'm mis-using the libraries. What I want to achieve is a default pagination where a query would limit items by default (as my collection could be really large and I don't want someone accidentally trying to return 5 millions of documents). So, I have specified the scope on a model:

.
.
  "scope": {
    "limit": 3
  },
.
.

When I query for the items I get the correct number of them in the result (3):

http://localhost:3001/api/items?filter={"fields": { "id": true } }


[
    {
        id: "55c099d2ade17e831c9aa25f"
    },
    {
        id: "55c099d2ade17e831c9aa260"
    },
    {
        id: "55c099d2ade17e831c9aa261"
    }
]

When I add an additional limit filter to the query above, I still get the same 3 items in the result (but I'm expecting 2 only):

http://localhost:3001/api/items?filter={"fields": { "id": true }, "limit": 2 }

[
    {
        id: "55c099d2ade17e831c9aa25f"
    },
    {
        id: "55c099d2ade17e831c9aa260"
    },
    {
        id: "55c099d2ade17e831c9aa261"
    }
]

Could you please advise if I'm using the package wrongly or it's a bug? Is there a better way of doing a default pagination? Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions