factored out database into mongo engine
added equivalent engine for mysql