Skip to content

Commit d033e3b

Browse files
authored
Merge pull request MongoEngine#2475 from bagerard/fix_imprecise_doc_collection_name
Fix for imprecise doc on collection name (CamelCase -> snake_case)
2 parents 4428842 + 1b7c208 commit d033e3b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docs/guide/defining-documents.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,10 @@ Document collections
432432
====================
433433
Document classes that inherit **directly** from :class:`~mongoengine.Document`
434434
will have their own **collection** in the database. The name of the collection
435-
is by default the name of the class, converted to lowercase (so in the example
436-
above, the collection would be called `page`). If you need to change the name
437-
of the collection (e.g. to use MongoEngine with an existing database), then
438-
create a class dictionary attribute called :attr:`meta` on your document, and
435+
is by default the name of the class converted to snake_case (e.g if your Document class
436+
is named `CompanyUser`, the corresponding collection would be `company_user`). If you need
437+
to change the name of the collection (e.g. to use MongoEngine with an existing database),
438+
then create a class dictionary attribute called :attr:`meta` on your document, and
439439
set :attr:`collection` to the name of the collection that you want your
440440
document class to use::
441441

mongoengine/document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class Document(BaseDocument, metaclass=TopLevelDocumentMetaclass):
109109
110110
By default, the MongoDB collection used to store documents created using a
111111
:class:`~mongoengine.Document` subclass will be the name of the subclass
112-
converted to lowercase. A different collection may be specified by
112+
converted to snake_case. A different collection may be specified by
113113
providing :attr:`collection` to the :attr:`meta` dictionary in the class
114114
definition.
115115

0 commit comments

Comments
 (0)