code: function sortToMongo(sort) {
      if (!sort) return null
      var hash = {}, c
      sort.split(',').forEach(function(field) {
          c = field.charAt(0)
          if (c == '-') field = field.substr(1)
          hash[field.trim()] = (c == '-') ? -1 : 1
      })
      return hash
  }
docs: Convert comma separated list to mongo sort options. for example f('field1,+field2,-field3') -> {field1:1,field2:1,field3:-1}