Document the attribute of .from_json

This commit is contained in:
Bastien Gérard
2018-08-28 22:42:51 +02:00
parent 9ad959a478
commit 86548fc7bf
3 changed files with 81 additions and 22 deletions

View File

@@ -404,7 +404,15 @@ class BaseDocument(object):
@classmethod
def from_json(cls, json_data, created=False):
"""Converts json data to an unsaved document instance"""
"""Converts json data to a Document instance
:param json_data: The json data to load into the Document
:param created: If True, the document will be considered as a brand new document
If False and an id is provided, it will consider that the data being
loaded corresponds to what's already in the database (This has an impact of subsequent call to .save())
If False and no id is provided, it will consider the data as a new document
(default ``False``)
"""
return cls._from_son(json_util.loads(json_data), created=created)
def __expand_dynamic_values(self, name, value):