If Collection Versioning Enabled, show versionId in doc object #6772
mpresecan
started this conversation in
Feature Requests & Ideas
Replies: 1 comment
-
My specific usecase is the following: I have a quiz collection, and people can take quizzes. So I have another collection called quizAttempt, which have relationship to user, and quiz, but it should also have a field versionId of a quiz. This is needed because if user has taken a quiz, and after the quiz had changed, then I need the history of the quiz to retreave, because that's the quiz user has submitted. The current workarround is in quizAttempt have a hook which will updated versionId, of the latest quiz. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In the documentation Versions enabled, drafts disabled it says:
This is the exact use case I have, and I need to have an access to a history of my doc, which I can access via versionId, but the latest version id is not accessible in the doc itself.
Here is a proposal how the doc should be like:
I tried a workarround, to add an extra field
versionId
to the collecition, but then I need to update this field onafterChange
hook. InafterChange
hook I can get document ID, and with that I can hit payload.findVersion({collection: 'my-collection'}), and the latest doc will be the one just created. But then I will need to updateversionId
, which will cause anotherafterChange
hook invocation, and it will run in infinite loop.Is there some conveniant way to get versionId of a document if versioning is enabled?
EDIT: please see my comment bellow for the specific use case of mine. If this feature is not something required in other cases, then I can deal with this lack of versionId within doc
Beta Was this translation helpful? Give feedback.
All reactions