Skip to content

Instantly share code, notes, and snippets.

@bernsno
Created November 3, 2012 19:10
Show Gist options
  • Save bernsno/4008317 to your computer and use it in GitHub Desktop.
Save bernsno/4008317 to your computer and use it in GitHub Desktop.
# Subscriptions
Meteor.autosubscribe ->
Meteor.subscribe('app_types')
Meteor.subscribe('apps', Session.get('sort_attribute'), Session.get('sort_order'), Session.get('filter_type'))
Meteor.subscribe('servers')
# No sorting
Meteor.publish 'apps', (sort_attribute, sort_order, filter_type)->
sort = [[sort_attribute, sort_order]]
filters = {}
filters = { type: filter_type } if filter_type
Apps.find(filters, {sort: sort})
# Sends back apps correctly sorted
Meteor.publish 'apps', (sort_attribute, sort_order, filter_type)->
filters = {}
filters = { type: filter_type } if filter_type
Apps.find(filters, {sort: [["name", -1]]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment