Grouping an array by postId and userId
As you noted, a more functional solution could be better.  Here is a way to write it using lodash.js:

var data = [
             { userId: 1, postId: 1, postData: "first post first user" },
             { userId: 1, postId: 2, postData: "second post first user" },
             { userId: 2, postId: 3, postData: "first post second user" }
           ];

posts = _
  .chain(data)
  .groupBy('userId')
  .mapValues(function(x) {
    return _.extend.apply(this, _.map(x, function (y) {
      return {[y.postId]: y.postData };
    }));
  })
  .value();


The .groupBy('userId') makes the intention clearer, but whether it is a better solution than the original is debatable.  Therefore, you may be better off leaving the code as it is.