Recursively create mongo query for embeddeddocument elemMatch

This commit is contained in:
reallistic
2015-09-24 16:31:38 -07:00
parent 79a2d715b0
commit 159b082828
3 changed files with 23 additions and 8 deletions

View File

@@ -4116,6 +4116,15 @@ class QuerySetTest(unittest.TestCase):
ak = list(Bar.objects(foo__match=Foo(shape="square", color="purple")))
self.assertEqual([b1], ak)
ak = list(
Bar.objects(foo__elemMatch={'shape': "square", "color__exists": True}))
self.assertEqual([b1, b2], ak)
ak = list(
Bar.objects(foo__match={'shape': "square", "color__exists": True}))
self.assertEqual([b1, b2], ak)
def test_upsert_includes_cls(self):
"""Upserts should include _cls information for inheritable classes
"""