Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changes in 0.10.6 - Dev
- Add support for mocking MongoEngine based on mongomock. #1151
- Fixed not being able to run tests on Windows. #1153
- Allow creation of sparse compound indexes. #1114
- count on ListField of EmbeddedDocumentField fails. #1187

Changes in 0.10.5
=================
Expand Down
2 changes: 1 addition & 1 deletion mongoengine/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ def validate(self, value):

def prepare_query_value(self, op, value):
if self.field:
if op in ('set', 'unset') and (
if op in ('set', 'unset', None) and (
not isinstance(value, basestring) and
not isinstance(value, BaseDocument) and
hasattr(value, '__iter__')):
Expand Down
10 changes: 10 additions & 0 deletions tests/queryset/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3613,6 +3613,15 @@ class MyDoc(Document):
self.assertEqual(MyDoc.objects.count(), 10)
self.assertEqual(MyDoc.objects.none().count(), 0)

def test_count_list_embedded(self):
class B(EmbeddedDocument):
c = StringField()

class A(Document):
b = ListField(EmbeddedDocumentField(B))

self.assertEqual(A.objects(b=[{'c': 'c'}]).count(), 0)

def test_call_after_limits_set(self):
"""Ensure that re-filtering after slicing works
"""
Expand Down Expand Up @@ -4888,5 +4897,6 @@ class Doc(Document):

self.assertEqual(1, Doc.objects(item__type__="axe").count())


if __name__ == '__main__':
unittest.main()