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 @@ -8,6 +8,7 @@ Development
===========
- (Fill this out as you fix issues and develop your features).
- EnumField improvements: now `choices` limits the values of an enum to allow
- Fix bug that prevented instance queryset from using custom queryset_class #2589
- Fix deepcopy of EmbeddedDocument #2202
- Fix error when using precision=0 with DecimalField #2535
- Add support for regex and whole word text search query #2568
Expand Down
7 changes: 2 additions & 5 deletions mongoengine/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,11 +583,8 @@ def cascade_save(self, **kwargs):
def _qs(self):
"""Return the default queryset corresponding to this document."""
if not hasattr(self, "__objects"):
queryset_class = self._meta.get("queryset_class")
if queryset_class is not None:
self.__objects = queryset_class(self.__class__, self._get_collection())
else:
self.__objects = QuerySet(self.__class__, self._get_collection())
queryset_class = self._meta.get("queryset_class", QuerySet)
self.__objects = queryset_class(self.__class__, self._get_collection())
return self.__objects

@property
Expand Down
2 changes: 1 addition & 1 deletion tests/queryset/test_queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3931,7 +3931,7 @@ class Post(Document):
Post.drop_collection()

assert isinstance(Post.objects, CustomQuerySet)
assert not Post.objects.delete()
assert Post.objects.delete() == 0

post = Post()
post.save()
Expand Down