A plugin for the model to store them easily within the object-store.
// Initialization of a new model-store:varstore=ModelStore();// Create a stamping model class which is then nested into the// employee class.varStamping=Employee.model('stamping').use(store()).attr('start').attr('end');// The name is stored like the followingStamping.typeName==='stamping';// The employee nests the type `Stamping`. The first part declares// the types of the employee and the second part declares the// attributes.varEmployee=model('employee').use(store())// this gives the stamping class a new attribute called `employee`// which stores the reference to the `Employee`..attr('name').attr('stamping',{ref: Stamping}).attr('stamping',Stamping).attr('stampings',[{ref: Stamping}]).attr('stampings2',[Stamping])// ...;Employee.stamping.get();Employee.stampings.all();// use the modelvaremployee=newEmployee({name: 'John Smith'});employee.stampings2.at(1);varStampings=employee.stampings;varstamping=employee.stampings.create({start: newDate()});varEmployeeStamping=employee.stampings;newEmployeeStamping();// the stamping has a back-reference to the employeestamping.employee===employee;// save the modelemployee.save(function(err,res){// ...});// fetches /employees/:employee/stampings/id58294employee.stampings.get('id58294',function(err,stamping){});employee.stampings.all(function(err,stampings){// ...stampings.save();});