payload icon indicating copy to clipboard operation
payload copied to clipboard

Versions do not work on collections with custom IDs

Open apetrisor opened this issue 1 year ago • 0 comments

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:

Screenshot 2024-03-18 at 13 17 12

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

  1. Create a collection with Number IDs and versions active.
  2. Create a document
  3. Create a new version for that document
  4. Try to access the version.

Payload Version

2.11.2

Adapters and Plugins

db-mongodb

apetrisor avatar Mar 18 '24 13:03 apetrisor