#MongoDB Action for Payload CMS UI Access
12 messages · Page 1 of 1 (latest)
Original message from @tidal coral - Moved from #general message
Help is on the way! To mark it as solved, use the /solve command. In the meantime, here are some existing threads that may help you:
Documentation:
- What is Payload? - Use Cases - Digital Asset Management
- Production Deployment - Database
- MongoDB - Access to Mongoose models
Community-Help:
Hey @tidal coral
Not too sure I follow here - can you walk me through exactly what you're looking for? The Admin UI definitely takes advantage of the find operation, and it's db agnostic
Sure. Thanks for your time.
According to here: #1366738555975635035 message I try to create a “virtual” collection.
I am currently modifying the Mongoose adapter so that when something from the "virtual" collection is needed, I have my own logic.
For my little MVP, this works for a specific item with "findOne", "find" also works when opening the collection api. But the UI still doesn't show the actual items or try to get the data with "find".
I see...
Hmm, I don't think you can just swap the collection out for a "virtual" one like that simply. The list view renders out a table on the server using things like a collection config and other data. I personally think it might actually be easier to use a custom list view
You would say: A custom list view where I could use the payload api which fetches the correct data from the external api? Like I do currently but with a custom list view?
Correct
For reference, this is how the list view is rendered currently with traditional collections: https://github.com/payloadcms/payload/blob/main/packages/next/src/views/List/index.tsx#L43
It's more work than just replacing a singular data source to try to hook into the existing way I think
But why doesn't the standard list view retrieve its data with "find"? How is the data fetched? At first look, it also uses the payload api
It does, but it doesn't just do a singular find and then display - it renders a table on the server and uses other properties like collection config to construct it