The Learning Locker Aggregate HTTP interface utilises the Mongo aggregation API and is only available for allowed collections. The Aggregate HTTP Interface is more advanced than the xAPI HTTP interface and allows you to access MongoDB's powerful Aggregation API for more custom filtration of documents.
This interface can be used to aggregate on multiple allowed only collections. To check whether a collection is allowed for aggregation or not, we use a regular expression. You can specify your own rule using AGGREGATE_API_ALLOWED_COLLECTIONS environment variable with ^rollup default value that means that by default you can aggregate on collections that prefixed with "rollup" word.
When using this interface, you must additionally supply your Basic Auth details with each request in the Authorization header. Your Basic Auth details can be found under Settings > Clients. The interface can be passed options via a JSON object in the request body (described in the table below). The collection property is required. The collection is a string that determines the collection name used to execute the aggregation on. The other properties are optional.
Array containing a pipeline of stages for documents to pass through before being output from the interface.
(in this case, you'll get records from the desired collection without any transformations)
Number that specifies a number of records that should be skipped from the beginning. This parameter will be transformed into $skip aggregation stage and executed at the very end.
Number that specifies a number of records that will be cut from the final results. This parameter will be transformed into $limit aggregation stage and executed at the very end.
Number that specifies the time limit for the query in Mongo.
(if nothing else was set to MAX_TIME_MS environment variable)
Specifies the number of documents to return in each batch of the response from the MongoDB instance. Defaults to 100
Specifies a Mongo collection index to use instead of the chosen index selected during the query planner stage. We recommend only using this parameter in the rare cases when Mongo isn’t choosing the best index during the initial query planner stage.
A simple request to this interface using all of the available parameters looks like the request below.