Merge pull request #2475 from bagerard/fix_imprecise_doc_collection_name
Fix for imprecise doc on collection name (CamelCase -> snake_case)
This commit is contained in:
commit
d033e3b133
@ -432,10 +432,10 @@ Document collections
|
|||||||
====================
|
====================
|
||||||
Document classes that inherit **directly** from :class:`~mongoengine.Document`
|
Document classes that inherit **directly** from :class:`~mongoengine.Document`
|
||||||
will have their own **collection** in the database. The name of the collection
|
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
|
is by default the name of the class converted to snake_case (e.g if your Document class
|
||||||
above, the collection would be called `page`). If you need to change the name
|
is named `CompanyUser`, the corresponding collection would be `company_user`). If you need
|
||||||
of the collection (e.g. to use MongoEngine with an existing database), then
|
to change the name of the collection (e.g. to use MongoEngine with an existing database),
|
||||||
create a class dictionary attribute called :attr:`meta` on your document, and
|
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
|
set :attr:`collection` to the name of the collection that you want your
|
||||||
document class to use::
|
document class to use::
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ class Document(BaseDocument, metaclass=TopLevelDocumentMetaclass):
|
|||||||
|
|
||||||
By default, the MongoDB collection used to store documents created using a
|
By default, the MongoDB collection used to store documents created using a
|
||||||
:class:`~mongoengine.Document` subclass will be the name of the subclass
|
: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
|
providing :attr:`collection` to the :attr:`meta` dictionary in the class
|
||||||
definition.
|
definition.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user