code: function createFieldSorter(sort) {
  
    function getFieldValuesAsArray(doc) {
      return sort.map(function (sorting) {
        var fieldName = getKey(sorting);
        var parsedField = parseField(fieldName);
        var docFieldValue = getFieldFromDoc(doc, parsedField);
        return docFieldValue;
      });
    }
  
    return function (aRow, bRow) {
      var aFieldValues = getFieldValuesAsArray(aRow.doc);
      var bFieldValues = getFieldValuesAsArray(bRow.doc);
      var collation = collate(aFieldValues, bFieldValues);
      if (collation !== 0) {
        return collation;
      }
      // this is what mango seems to do
      return utils.compare(aRow.doc._id, bRow.doc._id);
    };
  }
docs: create a comparator based on the sort object