a MongoDB collection (read- and writable)
a MongoDB collection (read- and writable)
Creates indexes to speed up read access. Can be safely used even if indexes already exist.
Saves data when a user completes content or replaces the previous finished data.
Deletes all userContentData objects for a given contentId. (Used when deleting content) Throws errors if something goes wrong.
The content id to delete.
Deletes a contentUserData object. (Useful for implementing GDPR rights functionality.) Throws errors if something goes wrong.
the user of the content user data that should be deleted
Deletes all finished user data of a content object. (Called when the content object is deleted)
Deletes all finished user data for a specific user (across all content objects). (Useful for implementing GDPR rights functionality.)
Deletes all content userData which has the invalidate field set to true. This method is called from the editor when content is changed and the saved contentUserData becomes invalidated.
The id of the content which to delete
Loads the contentUserData for given contentId, dataType and subContentId
The id of the content to load user data from
Used by the h5p.js client
The id provided by the h5p.js client call
Optional
contextId: stringan arbitrary value that can be used to save multiple states for one content - user tuple
the data
Lists all associated contentUserData for a given contentId and user.
The id of the content to load user data from
Optional
contextId: stringan arbitrary value that can be used to save multiple states for one content - user tuple
An array of objects containing the dataType, subContentId and the contentUserState as string in the data field.
Retrieves all contentUserData for a given user (Useful for implementing GDPR rights functionality.)
the user for which the contentUserData should be retrieved.
Gets the finished data of all users for a specific piece of content.
Gets all finished user data for a specific user (across all content objects). (Useful for implementing GDPR rights functionality.)
MongoDB storage for user data and finished data.
It is highly recommended to call
createIndexes
on initialization.