docs: function (selector) {
      var self = this;
      // you can pass a literal function instead of a selector
      if (_.isFunction(selector)) {
        self._isSimple = false;
        self._selector = selector;
        self._recordPathUsed('');
        return function (doc) {
          return {result: !!selector.call(doc)};
        };
      }
  
      // shorthand -- scalars match _id
      if (LocalCollection._selectorIsId(selector)) {
        self._selector = {_id: selector};
        self._recordPathUsed('_id');
        return function (doc) {
          return {result: EJSON.equals(doc._id, selector)};
        };
      }
  
      // protect against dangerous selectors.  falsey and {_id: falsey} are both
      // likely programmer error, and not what you want, particularly for
      // destructive operations.
      if (!selector || (('_id' in selector) && !selector._id)) {
        self._isSimple = false;
        return nothingMatcher;
      }
  
      // Top level can't be an array or true or binary.
      if (typeof(selector) === 'boolean' || isArray(selector) ||
          EJSON.isBinary(selector))
        throw new Error("Invalid selector: " + selector);
  
      self._selector = EJSON.clone(selector);
      return compileDocumentSelector(selector, self, {isRoot: true});
    }