nanomongo.field
¶
-
class
nanomongo.field.
Field
(*args, **kwargs)[source]¶ Instances of this class is used to define field types and automatically create validators:
field_name = Field(str, default='cheeseburger') foo = Field(datetime, auto_update=True) bar = Field(list, required=False)
-
__init__
(*args, **kwargs)[source]¶ Field kwargs are checked for correctness and field validator is set, along with other attributes such as
required
andauto_update
Keyword Arguments: - default: default field value, must pass type check, can be a
callable
- required: if
True
field must exist and not beNone
(default:True
) - auto_update: set value to
datetime.utcnow()
before inserts/saves; only valid for datetime fields (default:False
)
- default: default field value, must pass type check, can be a
-