Database interface consolidation

I think you've reviewed most of these changes consolidating calls to the mongodb driver and putting them into a common interface in core.database. I also made the change to store the open db in in the _db variable local to the core.database module so that the connection doesn't have to be repeatedly opened and closed.

Please keep this branch open, since I have additional changes that split the API into public and private interfaces, that we may or may not want to apply, depending on how this goes