Reformat repo with pre-commit hooks
This commit is contained in:
parent
78b240b740
commit
17151f67c2
@ -13,7 +13,7 @@ Help Wanted!
|
|||||||
|
|
||||||
The MongoEngine team is looking for help contributing and maintaining a new
|
The MongoEngine team is looking for help contributing and maintaining a new
|
||||||
Django extension for MongoEngine! If you have Django experience and would like
|
Django extension for MongoEngine! If you have Django experience and would like
|
||||||
to help contribute to the project, please get in touch on the
|
to help contribute to the project, please get in touch on the
|
||||||
`mailing list <http://groups.google.com/group/mongoengine-users>`_ or by
|
`mailing list <http://groups.google.com/group/mongoengine-users>`_ or by
|
||||||
simply contributing on
|
simply contributing on
|
||||||
`GitHub <https://github.com/MongoEngine/django-mongoengine>`_.
|
`GitHub <https://github.com/MongoEngine/django-mongoengine>`_.
|
||||||
|
@ -10,4 +10,3 @@ If this is a requirement for your project, check the alternative: `uMongo`_ and
|
|||||||
|
|
||||||
.. _uMongo: https://umongo.readthedocs.io/
|
.. _uMongo: https://umongo.readthedocs.io/
|
||||||
.. _MotorEngine: https://motorengine.readthedocs.io/
|
.. _MotorEngine: https://motorengine.readthedocs.io/
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ using 3 different databases to store data::
|
|||||||
connect(alias='user-db-alias', db='user-db')
|
connect(alias='user-db-alias', db='user-db')
|
||||||
connect(alias='book-db-alias', db='book-db')
|
connect(alias='book-db-alias', db='book-db')
|
||||||
connect(alias='users-books-db-alias', db='users-books-db')
|
connect(alias='users-books-db-alias', db='users-books-db')
|
||||||
|
|
||||||
class User(Document):
|
class User(Document):
|
||||||
name = StringField()
|
name = StringField()
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
Use mongomock for testing
|
Use mongomock for testing
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
`mongomock <https://github.com/vmalloc/mongomock/>`_ is a package to do just
|
`mongomock <https://github.com/vmalloc/mongomock/>`_ is a package to do just
|
||||||
what the name implies, mocking a mongo database.
|
what the name implies, mocking a mongo database.
|
||||||
|
|
||||||
To use with mongoengine, simply specify mongomock when connecting with
|
To use with mongoengine, simply specify mongomock when connecting with
|
||||||
mongoengine:
|
mongoengine:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
@ -44,8 +44,8 @@ Available signals include:
|
|||||||
|
|
||||||
`post_save`
|
`post_save`
|
||||||
Called within :meth:`~mongoengine.Document.save` after most actions
|
Called within :meth:`~mongoengine.Document.save` after most actions
|
||||||
(validation, insert/update, and cascades, but not clearing dirty flags) have
|
(validation, insert/update, and cascades, but not clearing dirty flags) have
|
||||||
completed successfully. Passed the additional boolean keyword argument
|
completed successfully. Passed the additional boolean keyword argument
|
||||||
`created` to indicate if the save was an insert or an update.
|
`created` to indicate if the save was an insert or an update.
|
||||||
|
|
||||||
`pre_delete`
|
`pre_delete`
|
||||||
|
@ -8,7 +8,7 @@ After MongoDB 2.4 version, supports search documents by text indexes.
|
|||||||
Defining a Document with text index
|
Defining a Document with text index
|
||||||
===================================
|
===================================
|
||||||
Use the *$* prefix to set a text index, Look the declaration::
|
Use the *$* prefix to set a text index, Look the declaration::
|
||||||
|
|
||||||
class News(Document):
|
class News(Document):
|
||||||
title = StringField()
|
title = StringField()
|
||||||
content = StringField()
|
content = StringField()
|
||||||
@ -35,10 +35,10 @@ Saving a document::
|
|||||||
content="Various improvements").save()
|
content="Various improvements").save()
|
||||||
|
|
||||||
Next, start a text search using :attr:`QuerySet.search_text` method::
|
Next, start a text search using :attr:`QuerySet.search_text` method::
|
||||||
|
|
||||||
document = News.objects.search_text('testing').first()
|
document = News.objects.search_text('testing').first()
|
||||||
document.title # may be: "Using mongodb text search"
|
document.title # may be: "Using mongodb text search"
|
||||||
|
|
||||||
document = News.objects.search_text('released').first()
|
document = News.objects.search_text('released').first()
|
||||||
document.title # may be: "MongoEngine 0.9 released"
|
document.title # may be: "MongoEngine 0.9 released"
|
||||||
|
|
||||||
|
@ -91,4 +91,3 @@ Indices and tables
|
|||||||
* :ref:`genindex`
|
* :ref:`genindex`
|
||||||
* :ref:`modindex`
|
* :ref:`modindex`
|
||||||
* :ref:`search`
|
* :ref:`search`
|
||||||
|
|
||||||
|
@ -1193,7 +1193,9 @@ class BaseQuerySet(object):
|
|||||||
validate_read_preference("read_preference", read_preference)
|
validate_read_preference("read_preference", read_preference)
|
||||||
queryset = self.clone()
|
queryset = self.clone()
|
||||||
queryset._read_preference = read_preference
|
queryset._read_preference = read_preference
|
||||||
queryset._cursor_obj = None # we need to re-create the cursor object whenever we apply read_preference
|
queryset._cursor_obj = (
|
||||||
|
None
|
||||||
|
) # we need to re-create the cursor object whenever we apply read_preference
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
def scalar(self, *fields):
|
def scalar(self, *fields):
|
||||||
|
@ -51,4 +51,4 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
# %{python_sitearch}/*
|
# %{python_sitearch}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* See: http://docs.mongoengine.org/en/latest/changelog.html
|
* See: http://docs.mongoengine.org/en/latest/changelog.html
|
||||||
|
Loading…
x
Reference in New Issue
Block a user