Local API - Select which fields to return #2458
Replies: 3 comments 1 reply
-
👍🏼 on this, came here to add this feature request. I'd add a few points to the above:
I'm working on an enterprise level payload project now and the lack of more granular mongo support in the local api means we end up bypassing it all over the place and hitting mongoose directly via |
Beta Was this translation helpful? Give feedback.
-
+1 on this, I have a massive relation field in one doc and just fetching it seems to crash the Payload instance while I don't need it for every usage scenario |
Beta Was this translation helpful? Give feedback.
-
PR that adds Copy paste my message from Discord: https://discord.com/channels/967097582721572934/967097582721572937/1257435094377955368
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
While the local API doesn't have the api/http overhead, it still needs to download all the data from the database. For large documents (long text) this becomes quite the overhead when only needing a part of it (e.g. some metadata like title & description to display a card on the homepage).
The workaround I'm using right now is React's dedupe feature, e.g.
const getProject = cache(async (id) => payload.find())
, but a Prisma-like feature to have more fine-grained control over what's returned would be great (especially with next-payload, which will probably result in far greater use of the Local API 😜)Beta Was this translation helpful? Give feedback.
All reactions