From 1fcd706e1134518349c28c1550820727b54901ec Mon Sep 17 00:00:00 2001 From: Stefan Wojcik Date: Fri, 14 Jun 2019 14:57:12 +0200 Subject: [PATCH] Clearer docstring of Document._get_collection [ci skip] --- mongoengine/document.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mongoengine/document.py b/mongoengine/document.py index 341a41ba..35a7fde8 100644 --- a/mongoengine/document.py +++ b/mongoengine/document.py @@ -182,8 +182,13 @@ class Document(six.with_metaclass(TopLevelDocumentMetaclass, BaseDocument)): @classmethod def _get_collection(cls): - """Return the corresponding PyMongo collection of this document. - Upon the first call, it will ensure that indexes gets created. The returned collection then gets cached + """Return the PyMongo collection corresponding to this document. + + Upon first call, this method: + 1. Initializes a :class:`~pymongo.collection.Collection` corresponding + to this document. + 2. Creates indexes defined in this document's :attr:`meta` dictionary. + This happens only if `auto_create_index` is True. """ if not hasattr(cls, '_collection') or cls._collection is None: # Get the collection, either capped or regular.