Should we update the basic Meteor demo that comes with Meteor?


#1

Right now the initial code that comes with a new Meteor project uses Session to increment a counter when a button is clicked.

But what about changing the demo to using a Mongo Collection instead? That way you also demonstrate the live syncing of data across multiple clients. What if we change the javascript file included in new projects to this?

Clicks = new Mongo.Collection("clicks");

if (Meteor.isClient) {

  Template.hello.helpers({
    counter: function () {
      var click = Clicks.findOne();
      if (click)
        return click.clicks;
    }
  });

  Template.hello.events({
    'click button': function () {
      var click = Clicks.findOne();
      if (click)
        Clicks.update({_id: click._id}, {$inc: {clicks: 1}});
    }
  });
}

if (Meteor.isServer) {
  Meteor.startup(function () {
    Clicks.remove({});
    Clicks.insert({clicks: 0});
  });
}

Or is that too much of a leap for a first time project?


#2

As a beginning meteor user I learned how to store data in sessions right from the current default project code and it was helpful.


#3

while Session has been presented (wrongfully, imo) as a go-to pattern, it does serve the purpose of conveying a higher concept of reactivity.

perhaps there should be a “next step” tutorial introduced to the masses under bright, persuasive spotlights


#4

I’d be interested in a slightly more incremental change of switching out Session for ReactiveDict, to emphasize that you can define your own whenever you want instead of using a single global store. However, that requires documenting ReactiveDict as a first-class thing in the docs (which we should do anyway).

However, I do think it would be useful to introduce the concept of collections here as well. Interesting.