Best Practise for generic Model-Inheritance and attaching it to a Collection via transform?


Hi guys,

I’d love to know about the current best-practise on how to attach generic properties to a MongoCollection.

It seems like this is currently the best pattern to use (It comes from

It uses prototype so it takes care of the memory in the browser with BIG datasets.

MY 2 Newbie-QUESTIONS are:
1) How do I make ProductCollection inherit its properties from TWO SuperClasses (p.e. Product and Item)?
2) Is this really best-practise?

Product = function (doc) {
  _.extend(this, doc);

Product.prototype = {
  constructor: Product,

  formatPrice: function (format) {
    switch(format) {
      case "cents":
        return this.price;
        return (this.price / 100).toFixed(2);

ProductCollection = new Meteor.Collection("products", {
  transform: function (doc) {
    return new Product(doc);


This is a vast topic with not one best practice, athough there are some good packages that hide away the abstractions with some clear api’s.

Take a look at these: