Fix MongoTestCase and add test for it