code: function match (obj, query) {
    var queryKeys, queryKey, queryValue, i;
  
    // Primitive query against a primitive type
    // This is a bit of a hack since we construct an object with an arbitrary key only to dereference it later
    // But I don't have time for a cleaner implementation now
    if (isPrimitiveType(obj) || isPrimitiveType(query)) {
      return matchQueryPart({ needAKey: obj }, 'needAKey', query);
    }
      
    // Normal query
    queryKeys = Object.keys(query);
    for (i = 0; i < queryKeys.length; i += 1) {
      queryKey = queryKeys[i];
      queryValue = query[queryKey];
    
      if (queryKey[0] === '$') {
        if (!logicalOperators[queryKey]) { throw "Unknown logical operator " + queryKey; }
        if (!logicalOperators[queryKey](obj, queryValue)) { return false; }
      } else {
        if (!matchQueryPart(obj, queryKey, queryValue)) { return false; }
      }
    }
  
    return true;
  }
docs: Tell if a given document matches a query
  @param {Object} obj Document to check
  @param {Object} query