Fix #863: Request Support for $min, $max Field update operators

This commit is contained in:
David Bordeynik
2015-02-17 14:38:10 +02:00
parent aca8899c4d
commit 129632cd6b
3 changed files with 13 additions and 1 deletions

View File

@@ -510,6 +510,17 @@ class QuerySetTest(unittest.TestCase):
self.assertEqual(post.comments[0].by, 'joe')
self.assertEqual(post.comments[0].votes.score, 4)
def test_update_min_max(self):
class Scores(Document):
high_score = IntField()
low_score = IntField()
scores = Scores(high_score=800, low_score=200)
scores.save()
Scores.objects(id=scores.id).update(min__low_score=150)
self.assertEqual(Scores.objects(id=scores.id).get().low_score, 150)
Scores.objects(id=scores.id).update(min__low_score=250)
self.assertEqual(Scores.objects(id=scores.id).get().low_score, 150)
def test_updates_can_have_match_operators(self):
class Comment(EmbeddedDocument):