Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
Versions do not work on collections with custom IDs, on mongodb. (have not tested postgres)
You can create multiple versions, and list them, but when trying to access any version item you get a CastError:
It happens whether you are using the admin UI or the REST API. This is because the system is trying to cast the _id of the version to the id type of the parent, and they obviously don't match. The issue lies in the db-mongodb package.
I found the solution, will submit a PR soon.
To Reproduce
Create a collection with Number IDs and versions active.
Link to reproduction
No response
Describe the Bug
This is a breaking bug.
Versions do not work on collections with custom IDs, on mongodb. (have not tested postgres)
You can create multiple versions, and list them, but when trying to access any version item you get a CastError:
It happens whether you are using the admin UI or the REST API. This is because the system is trying to cast the _id of the version to the id type of the parent, and they obviously don't match. The issue lies in the db-mongodb package.
I found the solution, will submit a PR soon.
To Reproduce
Payload Version
2.11.2
Adapters and Plugins
db-mongodb