Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Indexes - explanations?

default discord avatar
plainnn2 years ago
4

Hi, I've seen indexes as an option for collections but i'm struggling to find much more on them. I assume they make data retrieval faster but would love some more details.



I did a search in here and found this -

https://github.com/payloadcms/payload/blob/master/test/fields/collections/Indexed/index.ts

but it doesn't give much explanation!

  • discord user avatar
    alessiogr
    2 years ago

    This will be an interesting read for you:

    https://www.mongodb.com/docs/manual/indexes/
  • default discord avatar
    plainnn2 years ago

    Thank you



    So if I understand correctly, if I had a collection of posts (image, text, date, few boolean values) there isn't much point indexing them. Since we need the entire collection and don't query for single fields or values

  • discord user avatar
    alessiogr
    2 years ago

    Unless you want to, for example, search or filter your collections by those boolean values for example. With indexes, that would be faster

  • default discord avatar
    plainnn2 years ago

    We just list them out, like a social media feed so I guess they aren't needed. Thanks for explaining 🙂

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.