How to query all items, without pagination?

default discord avatar
4000degrees
10 months ago
6

How to get all items without pagination?


Tried setting limit to 0 and -1.


Thanks

  • discord user avatar
    jarrod_not_jared
    Payload Team
    10 months ago

    I’m not sure you can at the moment. You would have to query for at least 1 and then get the totalDocs from there and then query again for that number

  • discord user avatar
    denolfe
    Payload Team
    10 months ago

    I would expect

    ?limit=0

    to return all documents. What behavior are you seeing?



    Hmm, just tested this out. 0 doesn't appear to work how I'd expect. Could always pass 999



    Might submit this as a bug, tbh

  • default discord avatar
    4000degrees
    10 months ago

    @denolfe this is what I do atm. Thanks, will create a bug

  • default discord avatar
    snackdex
    3 weeks ago

    it looks like if i pass 0 it returns all documents, but i'm not seeing this documented anywhere and i can't find if the issue was closed. is this the way?

  • default discord avatar
    cbratschi
    3 weeks ago

    Also had to manually find the right value and 0 was fine.

  • discord user avatar
    jesschow
    Payload Team
    6 days ago

    We'll get it added into the documentation to help others, thanks for reporting šŸ‘

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.