ILibraryStorageinterface that stores the metadata and files of libraries in MongoDB. As the library files should never be above the limit of MongoDB's binary data fields (~5 MB), we we don't use GridFS. You can find the storage class in /packages/h5p-mongos3/src/MongoLibraryStorage.ts.
npm install mongodb!
createIndexes()every time you start you application, as MongoDB checks if indexes already exist before it creates new ones.
initMongothrough the function parameters. Alternatively you can use these environment variables instead of using the function parameters:
h5pto any name you want. If the collection doesn't exist yet, it will be automatically created.
initMongoand instantiate the required clients yourself.
/test/implementation/db/MongoLibraryStorage.test.ts. However, these tests will not be called automatically when you run
npm run testor other test calls. The reason is that the tests require a running MongoDB and S3 instance and thus need more extensive setup. To manually execute the tests call
npm run test:db.