Skip to content

Commit

Permalink
Merge branch 'master' into draft_v017
Browse files Browse the repository at this point in the history
  • Loading branch information
Erdenezul Batmunkh committed Mar 10, 2019
2 parents 7b4245c + 1a86372 commit fb8c0d8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Development
Changes in 0.17.0
=================
- Fix .only() working improperly after using .count() of the same instance of QuerySet
- Fix batch_size that was not copied when cloning a queryset object #2011
- POTENTIAL BREAKING CHANGE: All result fields are now passed, including internal fields (_cls, _id) when using `QuerySet.as_pymongo` #1976
- Document a BREAKING CHANGE introduced in 0.15.3 and not reported at that time (#1995)
- Fix InvalidStringData error when using modify on a BinaryField #1127
Expand Down
2 changes: 1 addition & 1 deletion mongoengine/queryset/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ def _clone_into(self, new_qs):
'_read_preference', '_iter', '_scalar', '_as_pymongo',
'_limit', '_skip', '_hint', '_auto_dereference',
'_search_text', 'only_fields', '_max_time_ms',
'_comment')
'_comment', '_batch_size')

for prop in copy_props:
val = getattr(self, prop)
Expand Down
10 changes: 10 additions & 0 deletions tests/queryset/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,16 @@ class A(Document):
with self.assertRaises(ValueError):
list(qs)

def test_batch_size_cloned(self):
class A(Document):
s = StringField()

# test that batch size gets cloned
qs = A.objects.batch_size(5)
self.assertEqual(qs._batch_size, 5)
qs_clone = qs.clone()
self.assertEqual(qs_clone._batch_size, 5)

def test_update_write_concern(self):
"""Test that passing write_concern works"""
self.Person.drop_collection()
Expand Down

0 comments on commit fb8c0d8

Please sign in to comment.