Mongodb extension refactorign