docs: function _get_type_by_name(self, document_type) {
  	return do_query(self, "SELECT * FROM types WHERE name = $1", [document_type]).then(get_results(NoPg.Type)).then(function(results) {
  		debug.assert(results).is('array');
  		if(results.length !== 1) {
  			if(results.length === 0) {
  				throw new TypeError("Database has no type: " + document_type);
  			}
  			throw new TypeError("Database has multiple types: " + document_type + " (" + results.length + ")");
  		}
  		var result = results.shift();
  		debug.assert(result).is('object');
  		return result;
  	});
  }