fixed up mongodb connection, added some tests for it