Mongodb extension refactorign

Forgive me that I created another copy of the request. I'm just learning to work with git.