Abstracted connection to switch between MongoStorage and web2pyStorage with one line change. Fixed most of the web2py DAL syntax. Also found that 'scope' is an SQL reserved keyword, so replaced that everywhere relevant.