mongodb tests refactoring