H5P NodeJS Library
    Preparing search index...

    MongoDB storage for user data and finished data.

    It is highly recommended to call createIndexes on initialization.

    Implements

    Index

    Constructors

    Methods

    • Creates indexes to speed up read access. Can be safely used even if indexes already exist.

      Returns Promise<void>

    • 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.

      Parameters

      • contentId: string

        The id of the content which to delete

      Returns Promise<void>

    • Loads the contentUserData for given contentId, dataType and subContentId

      Parameters

      • contentId: string

        The id of the content to load user data from

      • dataType: string

        Used by the h5p.js client

      • subContentId: string

        The id provided by the h5p.js client call

      • userId: string

        The user who owns this object

      • OptionalcontextId: string

        an arbitrary value that can be used to save multiple states for one content - user tuple

      Returns Promise<IContentUserData>

      the data

    • Lists all associated contentUserData for a given contentId and user.

      Parameters

      • contentId: string

        The id of the content to load user data from

      • userId: string

        The id of the user to load user data from

      • OptionalcontextId: string

        an arbitrary value that can be used to save multiple states for one content - user tuple

      Returns Promise<IContentUserData[]>

      An array of objects containing the dataType, subContentId and the contentUserState as string in the data field.