Mongo.Collection.prototype.helpers = function(helpers) {
  var self = this;

  if (self._transform && ! self._helpers)
    throw new Meteor.Error("Can't apply helpers to '" +
      self._name + "' a transform function already exists!");

  if (! self._helpers) {
      self._helpers = function Document(doc) {
          console.log(this);
      };
    self._transform = function(doc) {
      return new self._helpers(doc);
    };
  }

  _.each(helpers, function (helper, key) {
      var path = key.split(".");
      if (path.length === 1) {
          // key is root
          if (self._helpers.prototype[key]) {
              console.error("Cannot add helper at" + key + ". Helpers cannot override existing properties");
              return;
          }
          self._helpers.prototype[key] = helper;
          return;
      } else {
          // key is nested
          self._helpers._nestedHelperTree = self._helpers._nestedHelperTree || {};
          var tree = self._helpers._nestedHelperTree;
          for (var i = 0; i < path.length; i++) {
              if (i === path.length - 1) {
                  if (tree[path[i]]) {
                      console.error("Cannot add helper at" + key + ". Helper already defined");
                      return;
                  } else {
                      tree[path[i]] = helper;
                  }
              } else {
                  if (!tree[path[i]]) {
                      tree[path[i]] = {};
                  }
                  tree = tree[path[i]];
              }
          }
      }
  });
};

@@ -341,16 +341,1265 @@
      %7D;%0A
+      self._helpers._nest = function (tree, currentLevel) %7B%0A          for (var node in tree) %7B%0A              if (typeof tree%5Bnode%5D === %22function%22) %7B%0A                  // we expect tree leaves to be helper functions%0A                  currentLevel%5Bnode%5D = tree%5Bnode%5D;%0A              %7D else %7B%0A                  if (!currentLevel%5Bnode%5D) %7B%0A                      console.error(%22Cannot navigate past node %22 + node + %22 it does not exist.%22);%0A                      return;%0A                  %7D%0A                  if (!tree%5Bnode%5D.$ && !currentLevel%5Bnode%5D) %7B%0A                      console.error(%5B%22Property %22 + node + %22 does not exist.%22, tree, currentLevel%5D);%0A                      return;%0A                  %7D%0A                  if (node.indexOf(%22$%22) !== -1) %7B%0A                      console.error(%22$ must be preceded by an array%22);%0A                      return;%0A                  %7D%0A                  if (tree%5Bnode%5D.$) %7B%0A                      for (var i = 0; i %3C currentLevel%5Bnode%5D.length; i++) %7B%0A                          self._helpers._nest(tree%5Bnode%5D.$, currentLevel%5Bnode%5D%5Bi%5D);%0A                      %7D%0A                  %7D else %7B%0A                      self._helpers._nest(tree%5Bnode%5D, currentLevel%5Bnode%5D);%0A                  %7D%0A              %7D%0A           %7D%0A        %7D;%0A
     self

Define the nesting function