code: function matchesSelector(doc, selector) {
    /* istanbul ignore if */
    if (typeof selector !== 'object') {
      // match the CouchDB error message
      throw 'Selector error: expected a JSON object';
    }
  
    selector = massageSelector(selector);
    var row = {
      'doc': doc
    };
  
    var rowsMatched = filterInMemoryFields([row], { 'selector': selector }, Object.keys(selector));
    return rowsMatched && rowsMatched.length === 1;
  }
docs: return true if the given doc matches the supplied selector