Make queryset aggregates obey read_preference

This commit is contained in:
Benoit Larroque
2017-06-27 00:43:41 +02:00
parent a8d6e59a7a
commit 0bc6507df3
2 changed files with 24 additions and 0 deletions

View File

@@ -1182,6 +1182,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