This commit is contained in:
Victor 2016-08-04 08:31:19 +03:00
parent 25bc571f30
commit 327e164869
5 changed files with 12 additions and 2 deletions

View File

@ -239,3 +239,4 @@ that much better:
* Joshua Nedrud (https://github.com/Neurostack) * Joshua Nedrud (https://github.com/Neurostack)
* Shu Shen (https://github.com/shushen) * Shu Shen (https://github.com/shushen)
* xiaost7 (https://github.com/xiaost7) * xiaost7 (https://github.com/xiaost7)
* Victor Varvaryuk

View File

@ -99,7 +99,7 @@ Some simple examples of what MongoEngine code looks like:
Tests Tests
===== =====
To run the test suite, ensure you are running a local instance of MongoDB on To run the test suite, ensure you are running a local instance of MongoDB on
the standard port, and run: ``python setup.py nosetests``. the standard port and have installed ``nose`` and ``rednose``, and run: ``python setup.py nosetests``.
To run the test suite on every supported Python version and every supported PyMongo version, To run the test suite on every supported Python version and every supported PyMongo version,
you can use ``tox``. you can use ``tox``.

View File

@ -16,6 +16,7 @@ Changes in 0.10.7 - DEV
- Fixed AttributeError when initializing EmbeddedDocument with positional args. #681 - Fixed AttributeError when initializing EmbeddedDocument with positional args. #681
- Fixed no_cursor_timeout error with pymongo 3.0+ #1304 - Fixed no_cursor_timeout error with pymongo 3.0+ #1304
- Replaced map-reduce based QuerySet.sum/average with aggregation-based implementations #1336 - Replaced map-reduce based QuerySet.sum/average with aggregation-based implementations #1336
- Fixed support for `__` to escape field names that match operators names in `update` #1351
Changes in 0.10.6 Changes in 0.10.6
================= =================

View File

@ -44,7 +44,7 @@ def query(_doc_cls=None, **kwargs):
if len(parts) > 1 and parts[-1] in MATCH_OPERATORS: if len(parts) > 1 and parts[-1] in MATCH_OPERATORS:
op = parts.pop() op = parts.pop()
# Allw to escape operator-like field name by __ # Allow to escape operator-like field name by __
if len(parts) > 1 and parts[-1] == "": if len(parts) > 1 and parts[-1] == "":
parts.pop() parts.pop()
@ -212,6 +212,10 @@ def update(_doc_cls=None, **update):
if parts[-1] in COMPARISON_OPERATORS: if parts[-1] in COMPARISON_OPERATORS:
match = parts.pop() match = parts.pop()
# Allow to escape operator-like field name by __
if len(parts) > 1 and parts[-1] == "":
parts.pop()
if _doc_cls: if _doc_cls:
# Switch field names to proper names [set in Field(name='foo')] # Switch field names to proper names [set in Field(name='foo')]
try: try:

View File

@ -224,6 +224,10 @@ class TransformTest(unittest.TestCase):
self.assertEqual(1, Doc.objects(item__type__="axe").count()) self.assertEqual(1, Doc.objects(item__type__="axe").count())
self.assertEqual(1, Doc.objects(item__name__="Heroic axe").count()) self.assertEqual(1, Doc.objects(item__name__="Heroic axe").count())
Doc.objects(id=doc.id).update(set__item__type__='sword')
self.assertEqual(1, Doc.objects(item__type__="sword").count())
self.assertEqual(0, Doc.objects(item__type__="axe").count())
def test_understandable_error_raised(self): def test_understandable_error_raised(self):
class Event(Document): class Event(Document):
title = StringField() title = StringField()