def add_field(self, name, ftype, docfield=None):
        """ Add a field to the document (and to the underlying schema)
        
        :param name: name of the new field
        :type name: str
        :param ftype: type of the new field
        :type ftype: subclass of :class:`.GenericType`
        """
        self.schema.add_field(name, ftype)
        self[name] = docfield or DocField.FromType(ftype)