Skip to content

Commit

Permalink
Merge pull request #2439 from bagerard/improve_doc
Browse files Browse the repository at this point in the history
Improve Fields documentation
  • Loading branch information
bagerard committed Dec 8, 2020
2 parents 9ffe0bc + a190dfe commit 87babaa
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 192 deletions.
2 changes: 0 additions & 2 deletions docs/guide/gridfs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
GridFS
======

.. versionadded:: 0.4

Writing
-------

Expand Down
6 changes: 0 additions & 6 deletions mongoengine/base/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
class BaseField:
"""A base class for fields in a MongoDB document. Instances of this class
may be added to subclasses of `Document` to define a document's schema.
.. versionchanged:: 0.5 - added verbose and help text
"""

name = None
Expand Down Expand Up @@ -265,8 +263,6 @@ class ComplexBaseField(BaseField):
Allows for nesting of embedded documents inside complex types.
Handles the lazy dereferencing of a queryset by lazily dereferencing all
items in a list / dict rather than one at a time.
.. versionadded:: 0.5
"""

field = None
Expand Down Expand Up @@ -521,8 +517,6 @@ def validate(self, value):

class GeoJsonBaseField(BaseField):
"""A geo json field storing a geojson style object.
.. versionadded:: 0.8
"""

_geo_index = pymongo.GEOSPHERE
Expand Down
6 changes: 0 additions & 6 deletions mongoengine/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ def _get_connection_settings(
: param kwargs: ad-hoc parameters to be passed into the pymongo driver,
for example maxpoolsize, tz_aware, etc. See the documentation
for pymongo's `MongoClient` for a full list.
.. versionchanged:: 0.10.6 - added mongomock support
"""
conn_settings = {
"name": name or db or DEFAULT_DATABASE_NAME,
Expand Down Expand Up @@ -201,8 +199,6 @@ def register_connection(
: param kwargs: ad-hoc parameters to be passed into the pymongo driver,
for example maxpoolsize, tz_aware, etc. See the documentation
for pymongo's `MongoClient` for a full list.
.. versionchanged:: 0.10.6 - added mongomock support
"""
conn_settings = _get_connection_settings(
db=db,
Expand Down Expand Up @@ -386,8 +382,6 @@ def connect(db=None, alias=DEFAULT_CONNECTION_NAME, **kwargs):
See the docstring for `register_connection` for more details about all
supported kwargs.
.. versionchanged:: 0.6 - added multiple database support.
"""
if alias in _connections:
prev_conn_setting = _connection_settings[alias]
Expand Down
24 changes: 0 additions & 24 deletions mongoengine/document.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re
import warnings

from bson.dbref import DBRef
import pymongo
Expand Down Expand Up @@ -367,15 +366,6 @@ def save(
meta['cascade'] = True. Also you can pass different kwargs to
the cascade save using cascade_kwargs which overwrites the
existing kwargs with custom values.
.. versionchanged:: 0.8.5
Optional save_condition that only overwrites existing documents
if the condition is satisfied in the current db record.
.. versionchanged:: 0.10
:class:`OperationError` exception raised if save_condition fails.
.. versionchanged:: 0.10.1
:class: save_condition failure now raises a `SaveConditionError`
.. versionchanged:: 0.10.7
Add signal_kwargs argument
"""
signal_kwargs = signal_kwargs or {}

Expand Down Expand Up @@ -630,9 +620,6 @@ def delete(self, signal_kwargs=None, **write_concern):
For example, ``save(..., w: 2, fsync: True)`` will
wait until at least two servers have recorded the write and
will force an fsync on the primary server.
.. versionchanged:: 0.10.7
Add signal_kwargs argument
"""
signal_kwargs = signal_kwargs or {}
signals.pre_delete.send(self.__class__, document=self, **signal_kwargs)
Expand Down Expand Up @@ -714,8 +701,6 @@ def switch_collection(self, collection_name, keep_created=True):
def select_related(self, max_depth=1):
"""Handles dereferencing of :class:`~bson.dbref.DBRef` objects to
a maximum depth in order to cut down the number queries to mongodb.
.. versionadded:: 0.5
"""
DeReference = _import_class("DeReference")
DeReference()([self], max_depth + 1)
Expand All @@ -726,10 +711,6 @@ def reload(self, *fields, **kwargs):
:param fields: (optional) args list of fields to reload
:param max_depth: (optional) depth of dereferencing to follow
.. versionadded:: 0.1.2
.. versionchanged:: 0.6 Now chainable
.. versionchanged:: 0.9 Can provide specific fields to reload
"""
max_depth = 1
if fields and isinstance(fields[0], int):
Expand Down Expand Up @@ -831,9 +812,6 @@ def drop_collection(cls):
Raises :class:`OperationError` if the document has no collection set
(i.g. if it is `abstract`)
.. versionchanged:: 0.10.7
:class:`OperationError` exception raised if no collection available
"""
coll_name = cls._get_collection_name()
if not coll_name:
Expand Down Expand Up @@ -1088,8 +1066,6 @@ class MapReduceDocument:
an ``ObjectId`` found in the given ``collection``,
the object can be accessed via the ``object`` property.
:param value: The result(s) for this key.
.. versionadded:: 0.3
"""

def __init__(self, document, collection, key, value):
Expand Down

0 comments on commit 87babaa

Please sign in to comment.