MongoDB extension refactoring