Basic model for Mongo documents

Implemented some useful functions to save objects as Mongo documents,
and to retrieve them from MongoDB and return them as objects.