Set Access-Control-Allow-Origin header to * when the read API errors. This is to allow easier debugging in spotlight. This was originally going to be done in Nginx, however, on investigation it was discovered that we'd need a non-standard module to add headers to the response. This was a simpler route.
This means that we will capture log messages that are not specifically written to flasks logger. Before this commit we're not capturing any error logs from the rest of our application or from dependencies (unless they cause exceptions that bubble up to the flask layer).
The mongo collections are created on the fly when written to now. Delete has been left in for now so that a the capped size of a data set can be changed. When a data set is removed in stagecraft it is not removed in backdrop. This is fine for most cases as they data set can be emptied. However, if the capped size of the data set changes this will not be reflected in the data set unless it is first removed.
This decouples creation of a data set in stagecraft from creation in backdrop, which has been the cause of a lot of the bugs around creating data sets. Once this is done stagecraft can be updated to remove it's dependency on backdrop. Once that is done the create and delete end points here can be removed. One point to note is that collections will not be removed when the data set is deleted in stagecraft. The data set will not be available (queryable or writable), however, if a data set with the same group and type is created the previous data will still be there. Although it can be emptied.
Move the Query class from backdrop.read.query to backdrop.core.query. The core of backdrop depends on this class so it should not be in one of the app packages. I have left the functions used to parse a Query object from a flask request in backdrop.read.query as they're specific to the frontend.