code: function (doc) {
      var self = this;
      var minKey = null;
  
      self._generateKeysFromDoc(doc, function (key) {
        if (!self._keyCompatibleWithSelector(key))
          return;
  
        if (minKey === null) {
          minKey = key;
          return;
        }
        if (self._compareKeys(key, minKey) < 0) {
          minKey = key;
        }
      });
  
      // This could happen if our key filter somehow filters out all the keys even
      // though somehow the selector matches.
      if (minKey === null)
        throw Error("sort selector found no keys in doc?");
      return minKey;
    }
docs: Finds the minimum key from the doc, according to the sort specs.  (We say "minimum" here but this is with respect to the sort spec, so "descending" sort fields mean we're finding the max for that field.)  Note that this is NOT "find the minimum value of the first field, the minimum value of the second field, etc"... it's "choose the lexicographically minimum value of the key vector, allowing only keys which you can find along the same paths".  ie, for a doc {a: [{x: 0, y: 5}, {x: 1, y: 3}]} with sort spec {'a.x': 1, 'a.y': 1}, the only keys are [0,5] and [1,3], and the minimum key is [0,5]; notably, [0,3] is NOT a key.