function object() {
this.myProp1 = null;
this.myProp2 = null;
this.myProp3 = getProp3Calculation(); //from global calculation
this.init = function([params], callback){
var that = this;
var data = loadData(params);
var model = [Mongoose Schema];
model.findOne({name: value}, function (error, document) {
if (!error && document){
callback(document, 'Success');
}
else{
callback(null, 'Error retrieving document from DB');
}
});
//if asynchronous the following code will go into your loadCompletedHandler
//but be sure to reference "that" instead of "this" as "this" will have changed
that.myProp1 = data.Prop1;
that.myProp2 = data.Prop2;
};
[more functions and props for the object]
}