Merge pull request #1575 from zetaben/master

Make queryset aggregates obey read_preference
This commit is contained in:
erdenezul
2018-05-24 22:23:49 +08:00
committed by GitHub
2 changed files with 24 additions and 0 deletions

View File

@@ -1198,6 +1198,10 @@ class BaseQuerySet(object):
pipeline = initial_pipeline + list(pipeline)
if IS_PYMONGO_3 and self._read_preference is not None:
return self._collection.with_options(read_preference=self._read_preference) \
.aggregate(pipeline, cursor={}, **kwargs)
return self._collection.aggregate(pipeline, cursor={}, **kwargs)
# JS functionality