Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lafrech committed Mar 28, 2020
1 parent 5a62713 commit 9e1127a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions docs/userguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ In μMongo 3 worlds are considered:
Client world
------------

This is the data from outside μMongo, it can be JSON dict from your web framework
This is the data from outside μMongo, it can be a JSON dict from your web framework
(i.g. ``request.get_json()`` with `flask <http://flask.pocoo.org/>`_ or
``json.loads(request.raw_post_data)`` in `django <https://www.djangoproject.com/>`_)
or it could be regular Python dict with Python-typed data
or it could be a regular Python dict with Python-typed data

JSON dict example

Expand Down Expand Up @@ -614,7 +614,6 @@ marshmallow and umongo.
In marshmallow ``default`` contains the value to use during serialization
(i.e. calling ``schema.dump(doc)``) and ``missing`` the value for deserialization.
where the field is
In umongo however there is only a ``default`` attribute which will be used when
creating (or loading from user world) a document where this field is missing.
Expand All @@ -623,15 +622,15 @@ mongo world.
So when you use ``as_marshmallow_field``, the resulting marshmallow field's
``missing``&``default`` will be by default both infered from the umongo's
``default`` field. You can want to overwrite this behavior by using
``default`` field. You can overwrite this behavior by using
``marshmallow_missing``/``marshmallow_default`` attributes:
.. code-block:: python
@instance.register
class Employee(Document):
name = fields.StrField(default='John Doe')
birthday = fields.DateTimeField(marshmallow_missing='2000-01-01T00:00:00Z')
birthday = fields.DateTimeField(marshmallow_missing=dt.datetime(2000, 1, 1))
# You can use `missing` singleton to overwrite `default` field inference
skill = fields.StrField(default='Dummy', marshmallow_default=missing)
Expand Down

0 comments on commit 9e1127a

Please sign in to comment.