Ports DB connection to mongoengine and adds lots of tests