':param db_field: The database field to store this field in
(defaults to the name of the field)
:param name: Deprecated - use db_field
:param required: If the field is required. Whether it has to have a
value or not. Defaults to False.
:param default: (optional) The default value for this field if no value
has been set (or if the value has been unset).  It can be a
callable.
:param unique: Is the field value unique or not.  Defaults to False.
:param unique_with: (optional) The other field this field should be
unique with.
:param primary_key: Mark this field as the primary key. Defaults to False.
:param validation: (optional) A callable to validate the value of the
field.  Generally this is deprecated in favour of the
`FIELD.validate` method
:param choices: (optional) The valid choices
:param null: (optional) Is the field value can be null. If no and there is a default value
then the default value is set
:param sparse: (optional) `sparse=True` combined with `unique=True` and `required=False`
means that uniqueness won\'t be enforced for `None` values
:param **kwargs: (optional) Arbitrary indirection-free metadata for
this field can be supplied as additional keyword arguments and
accessed as attributes of the field. Must not conflict with any
existing attributes. Common metadata includes `verbose_name` and
`help_text`.'

def __init__(self, db_field=None, name=None, required=False, default=None, unique=False, unique_with=None, primary_key=False, validation=None, choices=None, null=False, sparse=False, **kwargs):

    self.db_field = ((db_field or name) if (not primary_key) else '_id')
    if name:
        msg = 'Field\'s    "name"    attribute    deprecated    in    favour    of    "db_field"'
        warnings.warn(msg, DeprecationWarning)
    self.required = (required or primary_key)
    self.default = default
    self.unique = bool((unique or unique_with))
    self.unique_with = unique_with
    self.primary_key = primary_key
    self.validation = validation
    self.choices = choices
    self.null = null
    self.sparse = sparse
    self._owner_document = None
    if ((self.db_field is not None) and (not isinstance(self.db_field, six.string_types))):
        raise TypeError('db_field    should    be    a    string.')
    if (isinstance(self.db_field, six.string_types) and (('.' in self.db_field) or ('\x00' in self.db_field) or self.db_field.startswith('$'))):
        raise ValueError('field    names    cannot    contain    dots    (".")    or    null    characters    ("\\0"),    and    they    must    not    start    with    a    dollar    sign    ("$").')
    conflicts = (set(dir(self)) & set(kwargs))
    if conflicts:
        raise TypeError(('%s    already    has    attribute(s):    %s' % (self.__class__.__name__, ',    '.join(conflicts))))
    self.__dict__.update(kwargs)
    if (self.db_field == '_id'):
        self.creation_counter = BaseField.auto_creation_counter
        BaseField.auto_creation_counter -= 1
    else:
        self.creation_counter = BaseField.creation_counter
        BaseField.creation_counter += 1
