improve doc (based on review)

This commit is contained in:
Bastien Gérard 2019-06-30 20:46:40 +02:00
parent c9ed930606
commit d37a30e083
5 changed files with 10 additions and 10 deletions

View File

@ -2,15 +2,15 @@
Document Validation
====================
By design, mongoengine strictly validates the documents right before they are inserted in MongoDB
By design, MongoEngine strictly validates the documents right before they are inserted in MongoDB
and make sure they are consistent with the fields defined in your models.
Mongoengine will not validate a document when an object is loaded from the DB into an instance
of your model but this operation will fail under some circumstances (e.g: if there is a field in
the document fetched from the database that is not defined in your model)
of your model but this operation will fail under some circumstances (e.g. if there is a field in
the document fetched from the database that is not defined in your model).
Builtin validation
Built-in validation
=================
Mongoengine provides different fields that encapsulate the corresponding validation
@ -73,7 +73,7 @@ Note that `clean` runs before the validation when you save a Document.
* Adding custom Field classes
We recommend as much as possible to use the standard field but it is also possible
We recommend as much as possible to use fields provided by MongoEngine. However, it is also possible
to subclass a Field and encapsulate some validation by overriding the `validate` method
.. code-block:: python

View File

@ -217,7 +217,7 @@ class EmbeddedDocumentList(BaseList):
Filters the list by only including embedded documents with the
given keyword arguments.
This method only supports simple comparison (e.g: .filter(name='John Doe'))
This method only supports simple comparison (e.g. .filter(name='John Doe'))
and does not support operators like __gte, __lte, __icontains like queryset.filter does
:param kwargs: The keyword arguments corresponding to the fields to

View File

@ -385,7 +385,7 @@ class DecimalField(BaseField):
:param max_value: Validation rule for the maximum acceptable value.
:param force_string: Store the value as a string (instead of a float).
Be aware that this affects query sorting and operation like lte, gte (as string comparison is applied)
and some query operator won't work (e.g: inc, dec)
and some query operator won't work (e.g. inc, dec)
:param precision: Number of decimal places to store.
:param rounding: The rounding rule from the python decimal library:

View File

@ -15,5 +15,5 @@ def get_mongodb_version():
:return: tuple(int, int)
"""
version_list = get_connection().server_info()['versionArray'][:2] # e.g: (3, 2)
version_list = get_connection().server_info()['versionArray'][:2] # e.g. (3, 2)
return tuple(version_list)

View File

@ -4,7 +4,7 @@ import unittest
from nose.plugins.skip import SkipTest
from mongoengine import connect
from mongoengine.connection import get_db, disconnect_all
from mongoengine.connection import disconnect_all, get_db
from mongoengine.mongodb_support import get_mongodb_version
@ -51,7 +51,7 @@ def _decorated_with_ver_requirement(func, mongo_version_req, oper):
ran against MongoDB < v3.6.
:param mongo_version_req: The mongodb version requirement (tuple(int, int))
:param oper: The operator to apply (e.g: operator.ge)
:param oper: The operator to apply (e.g. operator.ge)
"""
def _inner(*args, **kwargs):
mongodb_v = get_mongodb_version()