Tag Archive for javascript

Sorting collections in Meteor.js

I was surprised to find that it was trickier than I expected to find a good example of sorting my collection queries in meteor.js. It’s not hard, but the syntax was different than most of the MongoDB examples I was looking at. Here’s a sample format:

Template.myTemplate.gizmos = function () {
  return Gizmos.find({}, {sort: [[ name: "asc" ]]});
};

You can also accomplish the same thing like so:

Template.myTemplate.gizmos = function () {
  return Gizmos.find({}, {sort: { name: 1 }});
};

Single Page Application

I’m increasingly finding the idea of the Single Page Application mind-expanding. I think there’s a tendency to think of it as “the type of application you might write in an easy domain”, but I find it interesting try to imagine how any application you might write would look different if you thought about it in terms of a single page application.

Read more