E.g. If I want to fetch all pages and all users. Could that be done with one API call?
👍
ok so there are a few options
short answer, Payload doesn't do anything like that out of the box
but longer answer - you could open up a custom endpoint and use a MongoDB
aggregate
query that merges content from multiple collections into a single result set
OR, you could build some type of "search" collection
take a look at hope network's search functionality:
https://hopenetwork.org/
this site uses a collection called
Search
Ok thanks. I will investigate the custom endpoint route with MongoDb.
and then every collection that we want to search across has an
afterChange
hook, that syncs it to the
search
collection
so then the frontend of the hope site just queries against the
search
collection, and then documents from like 6 collections all get returned
in a very fast / performant way
this is good if you just need a quick solution. but another thing to look into, if you are going to be doing heavy searches, and you need it to scale with thousands of docs, is to use Algolia or similar
Cool, cheers @jmikrut