diff --git a/docs/guide/defining-documents.rst b/docs/guide/defining-documents.rst index 7fc20ba8..ed092907 100644 --- a/docs/guide/defining-documents.rst +++ b/docs/guide/defining-documents.rst @@ -432,10 +432,10 @@ Document collections ==================== Document classes that inherit **directly** from :class:`~mongoengine.Document` will have their own **collection** in the database. The name of the collection -is by default the name of the class, converted to lowercase (so in the example -above, the collection would be called `page`). If you need to change the name -of the collection (e.g. to use MongoEngine with an existing database), then -create a class dictionary attribute called :attr:`meta` on your document, and +is by default the name of the class converted to snake_case (e.g if your Document class +is named `CompanyUser`, the corresponding collection would be `company_user`). If you need +to change the name of the collection (e.g. to use MongoEngine with an existing database), +then create a class dictionary attribute called :attr:`meta` on your document, and set :attr:`collection` to the name of the collection that you want your document class to use:: diff --git a/mongoengine/document.py b/mongoengine/document.py index de00740b..8cdce1d0 100644 --- a/mongoengine/document.py +++ b/mongoengine/document.py @@ -109,7 +109,7 @@ class Document(BaseDocument, metaclass=TopLevelDocumentMetaclass): By default, the MongoDB collection used to store documents created using a :class:`~mongoengine.Document` subclass will be the name of the subclass - converted to lowercase. A different collection may be specified by + converted to snake_case. A different collection may be specified by providing :attr:`collection` to the :attr:`meta` dictionary in the class definition.