Migrate MongoDB functions to nsmmongo module