better docstring for BaseDocument.to_json
This commit is contained in:
parent
47c58bce2b
commit
b7ec587e5b
@ -402,9 +402,11 @@ class BaseDocument(object):
|
|||||||
raise ValidationError(message, errors=errors)
|
raise ValidationError(message, errors=errors)
|
||||||
|
|
||||||
def to_json(self, *args, **kwargs):
|
def to_json(self, *args, **kwargs):
|
||||||
"""Converts a document to JSON.
|
"""Convert this document to JSON.
|
||||||
:param use_db_field: Set to True by default but enables the output of the json structure with the field names
|
|
||||||
and not the mongodb store db_names in case of set to False
|
:param use_db_field: Serialize field names as they appear in
|
||||||
|
MongoDB (as opposed to attribute names on this document).
|
||||||
|
Defaults to True.
|
||||||
"""
|
"""
|
||||||
use_db_field = kwargs.pop('use_db_field', True)
|
use_db_field = kwargs.pop('use_db_field', True)
|
||||||
return json_util.dumps(self.to_mongo(use_db_field), *args, **kwargs)
|
return json_util.dumps(self.to_mongo(use_db_field), *args, **kwargs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user