From b7ec587e5b82717dd704a7812b576ceff405cff3 Mon Sep 17 00:00:00 2001 From: Stefan Wojcik Date: Wed, 28 Dec 2016 22:15:46 -0500 Subject: [PATCH] better docstring for BaseDocument.to_json --- mongoengine/base/document.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mongoengine/base/document.py b/mongoengine/base/document.py index 1667215d..9d366706 100644 --- a/mongoengine/base/document.py +++ b/mongoengine/base/document.py @@ -402,9 +402,11 @@ class BaseDocument(object): raise ValidationError(message, errors=errors) def to_json(self, *args, **kwargs): - """Converts a 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 + """Convert this document to JSON. + + :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) return json_util.dumps(self.to_mongo(use_db_field), *args, **kwargs)